You aren't writing any new line characters, so of course everything appears on one line. At the very least, you can include the new line characters for your platform in the string (e.g.
\n
on UNIX, not sure for Windows. There should be something in the standard library that gets you the platform specific new line characters, though). There may be a method on the file object that will let you pass a list or something and will write the lines for you (I thought it was called writelines
, but couldn't find it in the docs).