write output csv file