Would it be possible to post your full-code? It’s impossible to troubleshoot your problem with the example, and it seems from your description that there may be no need for many nested loops. A more full description as to your goals would also be helpful.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users