Sonata Races, Outer reaches help

My poor Flygon is stuck in the race. I’ve given up hope for winning but how the heck does it work? My pokemon just keeps moving around randomly in the middle and it’s not letting me move up through the track