Greetings, Charlie Choi!
Since you shared this possible solution, I've been studying power automate and recovering all previous knowledge I'd achieved a few years ago on VBA for MS Excel.
I've found other possible solutions using the expressions (output(..., initializing variables, Json, composing, do until, etc). But none of these solutions would be possible without your reply. You gave me a way to start how to understand Power Automate.
I'm grateful for your support!
I wish you all the best and a happy ending year.
Warm regards!