now writing data to csv files