The loop is causing the problem, but the calculation is also not correct. You need to get current X position and float compare with player’s x position. Smaller = flip.
To do this robustly and efficiently, use the start state to initialise, where you get the own X scale once, store it in variable, then float operate it with *-1 and store the flipped x value as well. That’s a failsafe in case you use an enemy who is not scale.x = 1. If that never, absolutely, swear-to-god never happens, you can just set -1 as you do already.
Then, you basically never need the start state again. In the main part, you need just two states that transition to each other. The first checks if the player’s pos is smaller than the own, and underneath set the X scale (not flipped). The greater or equal events are left blank. But when the player’s pos is smaller, go to the other state with identical actions. Only here, the smaller than and equal is left blank, and underneath the action you set the x flipped value you stored away. Depending on your game, all these states would run every frame.