i need to read a text file to a string. Add a line to the string and then output back to the text file.

The text file is a list of strings:

eg:
this is a test
this is a second test
this is what i need to add to the file

Please help.

I can read a single line from a text file to a string but i cant make it search through the whole text file!!