From the bottom sliver of your screenshot it looks like Activity-Campaign_Risk_Analysis has at least one sibling underneath Activity-Campaign-Overview, so your code is inserting the new Activity-Campaign_Risk_Analysis node after that field (and possibly others) instead of in line with the rest of the Activity-Campaign_Risk_Analysis.
It's for reasons like this that we advocate giving repeating groups their own exclusive non-repeating parent group, so that they don't have any siblings. Are you at a stage in your development cycle where you can rearrange your data source to meet that requirement?