Fixed CSV header and added gitignore file

CSV output was not working as expected: For every line, there was one header line. I fixed it.

I added a gitignore file to avoid .csv and .log files to be commited.