Best thing to do is always think what are you defining as a single transaction. In this case it will be each collection of line items for each Header Number. So each transaction will essentially be its own datatable that you need to build from your master table.
This example outputs distinct tables into csv files for each Header Number by first filtering the master table for distinct values. It then uses these to identify which lines go into which files.
Each of these files should then be sent to the Process Transaction stage of the Framework with one transaction equal to one file.
I hope that makes sense.
Edit: I had to add a clear datatable to ensure the values where removed when it moved through each distinct header number
CollectPOs.v2.zip (15.4 KB)