As both @ccstone and @peternlewis have noted, using quotes in a complex shell script is tricky. Take a look at this macro and see if it will help solve your problem. Sorry I don't have time right now to debug your specific use case.
If that does not do it, the look at other posts from this search: https://forum.keyboardmaestro.com/search?q=mdfind
For more information, see the wiki Searching the Forum for Answers section.