I had a looping flow and I figured out it was because the flow updated an item in the same list as the trigger for a created/modified item

I have a dedicated account for automated flows so I am able to exclude a flow from running if it has been edited by the dedicated account like so:

@not(contains(triggerBody()[‘Editor’], ‘<user name of your dedicated Flow account>’))

I have not tested the above code but to use it click the three dots on the trigger and go to settings:

Scroll to the bottom and click Add under Trigger Conditions and paste the expression code there

Reference: https://medium.com/@gurdevluck/prevent-infinite-loop-in-microsoft-flow-power-automate-b3cf9d764926