Looping help needed

Example: Let’s say I call a program and this programs returns me back two tables: