The tracking profile editor of BAM has some known limitations (see below two links). One of which is looping through repeating elements in a schema in a single TPE profile.
One common solution is to use activity relationships for the looped element/structure/node so that each of your <loopnode>
elements are processed individually in a separate activity. While a single TPE lacks language/features to access elements from each repeated node, a related activity that handles the processing of a repeating node will be called for each repetition allowing you to take whatever action(s) with the data in each.
There are multiple ways to do this. You can do this through BAM API using Activity Relationships or through the TPE using Folders: Relationship Folders and Continuation Folders.
In your case I believe the easiest way would be to use loopnode\id
as the ContinuationID passed into a Continuation activity, but if your loopnodes are actually more complex than one value you can choose to pass either multiple values or a more complex message.
See How to Create a Continuation
To learn more about BAM, Microsoft has this in-depth guide for learning all about BAM here