What loops? The part inside the branch or the entire event tab?
Code itself looks okay from a quick read, but you also need to have a look at the common events (click on the line, press spacebar, look at the number of the common event, cancel, go in the database and to the common events tab and take a screenshot of what's inside that event).
It could also be one of the text lines being incorrectly formatted. You're supposed to have an NPC number between the brackets behind \np. You sometimes have text there and you're not using the correct brackets in some spots.