Your code isn't messed up, this is a question about how your system handles lineendings.
Linux and OSX save lineendings differently from Windows.
Linux and OSX saves lineendings with a Line Feed
(LF):
\n
While windows saves it with Carriage Return + Line Feed
(CR+LF):
\r\n
So what is probably happening is that your file has been written on a system that doesn't save lineendings in the windows format. Your editor most probably supports these kind of line endings and can handle it, look into the menus of your editor.
** Below is part of an edit and not part of my answer.**
You can check EditorConfig which can be helpful when you are trying to keep settings across projects and/or editors and also, if you keep your code under git, Dealing with line endings article from Github may be also helpful.
End of edit
Read more here: Wiki article