Loop a combination of nodes

Good day!
I am working on viewTemplates’ replacing. As a part of it I want to bind views to viewTemplate which replaces. My algorithm of binding is in the attached image.
My problem is that if I want to transfer a list to Element.id and then extract views for a list of templates, it doesn’t work correctly. But if I transfer only 1 template(at the bottom) then everything works perfectly.
Can I create a for-loop, for instance, to send each of Template individually to extract views fir it and bind them to another Template? Or what can I undertake?