You put the new factions in an entirely new folder in the tech tree folder. If you want to make new magic/tech units without overwriting the original factions, you could copy the folders to something like "magic_mod" and "tech_mod" and put all the new units there.