add relationship between 2 modules during other logic_hooks process

Sorry but i find a little problem…cause it works only if only one record in Module C is retrieved…

So if 2 Goods are saved and must be related to 1 shipments does not work…

I need probably to make a foreach loop during relation action…
Could you please help me again?

Thank you