What engine did you use to replace the original ?
Were they the same ?
Or was there some rewiring ?
Only 2 things will stop the engine dead
Something grounding the coil or something de-energizing the carb solenoid
One is a ground circuit problem the other is a power wire problem
Start by working out which one it is
The 4 prong safety switches come NO-NC and NC-NO.
They look identical but of course work backwards
From the diagram Star posted it looks like a wrong brake switch would cause symptoms you are describing .