writes data to influxdb finally