changed addLineToFile() to add a newline if the file does not end with o...

...ne. this can fix issues like in #43