I didn’t really understand your question. This already loops through a list of inputs. Input should be flattten before connecting though.
If you are asking about working with DataTrees, take a look at this :
It would be a lot easier if you could share a sample model and the final result you want to achieve.
Regards,