I don’t believe you need the “With input from” part, but your KM variable does not appear to be defined properly for a shell script. It needs to be like so:
$KMVAR_VarName
…and some things require it to be enclosed in straight double quotes.
The incorrect word should be copied to the clipboard, I'm defining the variable and then passing it into the script which should return the corrected word to the clipboard. This functions right now in Alfred.
Not sure where the path comes into play into this.
I guess I could just run the alfred workflow from KBM - I figured this would be super simple, it's a very basic script...
The code includes an API key. Generally, keys like this are not shared amongst users, rather sites invite users to apply for their own API keys.
If you direct me to the original source of this code, I may be able to sort it out. You mentioned Alfred—I'm assuming it was a Shared Workflow, but with a quick search I was unable to locate it.
Take a look at Literary Toolbox III and Text Toolbox I. Literary Toolbox has a very simple macro that lets you check spelling on a selection using the macOS built-in Dictionary application, which can check anything from single words (providing likely alternatives) to whole files. It can also get you to a Thesaurus entry with a single click. A very handy if rarely mentioned utility.
I had considered using aspell for single word checks like @cdthomer's macro (and which Spell Catcher used to do for me) but when I realized Dictionary could do that, I thought it more efficient to use the default macOS solution rather than explain homebrew and aspell installations. Which, however, he's done very nicely.
Do you think aSpell is superior the mac built in dictionary @cdthomer? That is why I was using the Google Spell check script, I can be terrible at spelling sometimes and if I select a sentence and activate it - it would almost always get the word even if I butchered it (it got the context form full sentence).