How to convert and store modbus data into csv file