In terms of doing some tests, I would short out the end terminal on the magneto first and make sure that this stops the engine. If you have a multimeter, I would then disconnect the wire to the magneto and measured the resistance to the handlebar and see whether this goes to zero when you press the cut-out button. If it doesn't, either the wiring to the switch has a fault or the switch has a problem which could be the contact under the button not making good contact with the handlebar. If you do get zero resistance when you press the cut-out button, the problem might be that the handlebar does not have a good earth return path to the engine. Temporarily connecting a wire from the handlebar to the metal of the engine will then show whether this is the problem.