add writeCSV function and output