How can i access all the filter value specify by the user in listview

I want to filter the list view and then click a button that exports all the results of the filtered data to another doctype using a custom script. but then only have the few records on its view.
so I then plan to get the specified query of the filter and execute on my Doctype to get all the filtered results since can only access the batch of data display on its view.

Please I need a better way to implement this.
for example
list view display 20 items in batches and my filtered result is 200. with this only have access to 20 records out of this 200.
how can i access the entire 200

Use the “Data Export” in ERPNEXT