Why would you print a message to use /respawn when you can just trigger it from the code ?
Well, I didn't tell you to look at every single code there, you'll have to search... first find the "TeamInfo" hook, then find it's function and go from there.
Also, make sure you respawn player after he chose his class, not team, "TeamInfo" is called on both.