Keyboard Maestro Inserts Random Characters

First thing is to confirm that KM is causing or contributing to the issue.
Stop both the KM Engine and the KM Editor app, and see if the issue continues.

You can also review the last few entries in the KM Logs:
GoTo menu Help > Open Logs Folder, or just open this file:
~/Library/Logs/Keyboard Maestro/Engine.log

I don't know that this is the issue in your case, but I had a similar issue a few months ago where I was getting randomly typed "q" no matter what app I was in. Turned out to be an issue with the Logitech Control Center. After I removed the LCC, I know longer had the issue.

For more info see: