To big "Ifs" here but if I'm reading your question correctly and if the data in my excel sheet is right here are you magic steps.

To hit 25 with no wasted exp you need to have

L23 with 120 exp

L20 with 481 exp

L16 with 280 exp

L9 with 566 exp

L1 with 0 exp will exceed the L9/566 level after winning a trainer pet battle.