Garage editor 1.3.1 has an error and that is the reason why it resets.
It changes the experience points to 7576732(LVL33) and it should be 34634713(LVL 40).
So when you try to get LVL 40 it changes exp points to LVL 33 but the lvl to 40 and after race it resets the lvl to match the exp points.
I would recommend you to change the A-Spec and B-Spec to lvl 40 and then open your save with HxD editor(Or something similar).
Then search for the 00739C9C and change it to 02107BD9 in hex (There is two of these near each other because A and B-Spec has their own).
Here is the experience table at GTPlanet:
You must login or register to view this content.
You should change exp points to values seen in TOTAL but the editor changes them to values seen in XP and that's the value you need to get to achieve next rank.