why is this writing the last line twice to the file

Printable View