If you start a structure factory with structure kits, I don't think the AI will use them for it's building groups. I think it will only build buildings that it also produces the kits for.
Also, to set the kit in the factory without crashing the game, you need to use SetFactoryCargo on the unit. Trying to set the cargo the same way a convec's cargo is set, or the way a weapon turret is specified won't work.