Trying to write to a file but it only prints last line

Printable View