Set Locators/Loop by Regions/Events/Marquee and Enable Cycle/Loop ⌘U
Set the locators based on the current selection. I usually prefer the action of setting the locators by command as opposed to using the auto-set locators.
Use the cycle area in Logic Pro — Apple Support
Set Locators by Regions/Events/Marquee: Sets the locators at the start and end points of the selected regions or events, or the marquee selection.