IEven just moving the connection wires slightly at idle will cause the engine to die
Suggest you get a copy of MerCruiser service manual #17
It will have wiring diagrams and the instructions on how to resolve your problem.
If you have any questions after reading it, I’m sure we can help.