Create td_fun_export

apply a function to query chunks while being exported to a file