Store and query batched records from kapacitor using InfluxdbOut()

I have a tick script as follows:

dbrp "dummydb"."autogen"

var chunk = batch
                |query('SELECT * FROM "dummydb"."autogen".new_data')
                .period(1d)
                .every(5m)
                |influxDBOut()
                .database('dummydb')
                .retentionPolicy('daily')
                .measurement('out_data')

I have tried to batch records from ‘new_data’ measurement and store it to ‘out_data’ measurement under retention policy ‘daily’.

However, the objective is just to batch the records from the ‘new_table’ measurement in influxdb and ingest the batch data into a python script. I would appreciate if anyone can guide me towards achieving this.