I'm a little confused by your scenario...
A SharePoint list stores flat data. A list item will have a set number of columns with data and you can load each of those items via a secondary data connection, into an InfoPath form. Once in the InfoPath form, you'll have a repeating structure in your secondary data source (containing all the list items). You can copy one or many into the main data source.
That main data source is an XML file. It is not flat; that is, it can contain repeating data. Using a submit-type data connection, you can submit that XML file into a SharePoint form library. The ShP form library stores the XML file and promotes some properties into the columns. So while the data appears flat when you visit the form library, it is not flat; there's an underlying XML file for each form in the form library.
In order to submit each line item into an individual record, then your form's schema is probably not going to be repeating. That is, you'll have a form that queries the ShP list, the user can select one list item from the secondary data soure, that data is copied into the main data source (which is not repeating) and then you submit that XML into the form library. Then you open a new form, select another list item, and submit again.
Perhaps there's some way to have:
* a repeating table in an InfoPath form
* use the data from each row to generate an XML file
* submit each of those XML files (iteratively) into the form library (to generate a unique item for that row).
It would probably involve custom code and unfortunately I've never worked in such a scenario. It's confusing to me because in that scenario, you would basically end up with identical data (the data in the list is going to be identical to the data in the form library). There's no grouping or merging going on; it seems like a flat migration.
Can you provide more info on your scenario? Maybe someone else will be able to help out with further advice.