From the command line use
(Note that these must be completed on separate lines.)
This will insert on the first line of the file.
sed '1i\
your text goes here' file_name > new_filename
This will append on the last line of the file.
sed '$a\
your text goes here' file_name > new_filename
Note also that with
sed you have to direct the output and rename the file back. So 'mv new_filename file_name' when you are done with these commands.