Printing output in console and writing to file
Format for text file messed up. To investigate