Have you thought about reading in the contents of the file, adding the missing line, and then writing a new file?