You should definitely put $KMVAR_pathToMov in " double quotes. Always double-quote variables.
In your "Set Variable" line, you have escaped the space with a \ which it does not need. That is necessary for the shell -- but only if it is not double-quoted.
Using double-quotes is, IMO/IME, much easier and more reliable than using \ to escape spaces.
Thanks! I'll for sure put every path in double quotes in a shell script in the future. Unfortunately, it doesn't seem to solve my problem, as the handbrakeCLI does not load properly. It probably has to do with running it from within KM, but I'll have to investigate further…