Wire that to the logic that reads the kWh value and pushes it to the database. InfluxDb is not the only database you could use, but it is nice for time-series data, like this. Since you want to keep a long-term history, I would say a database is the right tool, especially if you plan to query for the data later in order to build reports or graphs.
A lighter-weight solution would be to write the data into a CSV file, or a local file-based database like sqlitedb. Search the flows.nodered.org site for example flows that do something similar...
Which version of influx are you using (1.8 or 2.0)?
I see you have selected, in the influx node, v1.8 using the flux query language. Unless you want to use flux then just select 1.8 (assuming you are using 1.8). Then you can query the database using the SQL like query language. Influx Query Language (InfluxQL) | InfluxDB OSS 1.8 Documentation
I don't think that influx 1.8 supports that, though I believe 2.0 does. I think it is possible in grafana using timeshift but I don't know exactly how.
I have avoided this problem by also storing the difference from the last value in the influx record. Then you can use cumulativeSum to add them up between two times.