How are the information saved in the file?
Can't you save the information in a database? And export it instead every time, if you need a file? What are you using it for in the end?
Easiest way are to read the entire file with file_get_contents. Append it to the end of the new line and save it again with file_put_contents.