Add code to write output to file

Add argument parser setting accordingly