Does it die as soon as it starts? Or is it more like it dies after you let the key spring back from cranking?
If it runs when cranking but dies as soon as key is released then I suspect the wiring to the ignition coil is not correct. There is a bypass circuit that gives the coil full 12v when cranking, then when key is released from cranking the ballast circuit to the coil is what supplies power thru ballast resistance, usually 9 volts or so.
All of that depends on what kind of ignition the replacement engine uses. Please describe what is on the new engine now (points, electronic, brand,etc)
Check voltage at the coil positive terminal (Meter black wire connected to Ground, red wire connected to coil positive) with the ignition switch in just On position, not cranking. Should be at least 8 volts and could be as much as 12. Zero volts means ballast circuit wiring is missing or ballast component(s) have failed.