Hi, I think maybe you are using some kind of a variable flag to keep a count of the number of times you are running the loop and that flag is same as external loop hence during incrementing you find an infinite loop instead of that try using end loop activity and end if activity to terminate the loops.
Moreover, try learning it by opting for Intellipaat's Automation Anywhere Certification.