1. Pickup an engineer building
2. Make sure to have "Respawn after loadout changes" enabled (multiplayer > advanced)
3. Switch your loadout inside your respawn (you should respawn after doing so)
4. Depending on what building you glitched, type:
Build 0 0 > dispensers / Build 1 0 > entrance / Build 1 1 > exit / Build 2 0 > sentry
5. If done correctly you should be able to build endlessly (You have to type in the code whenever you want to build, so you should bind it to a key)