When there are no spawnable blocks near an end gateway, it will loop you back to were you were before. This is because the default position the end gateway is the block directly above the gateway. since you are then directly inside the bedrock above the gateway, you fall back into it immediately.
This could probably be solved by spawning the player higher up, so that he stands on top of the bedrock instead.
- Go to the end (/execute in the_end run tp 0 ~ 0)
- kill the ender dragon (/kill @e[type=ender_dragon])
- If there are any blocks near the end gateway, remove them or generate a new one.
- Use an ender pearl to get through the gateway
- Use another ender pearl at the end gateway right next to you
→ You are teleported back to where you were before