write csv to file