I usually just use Script Debugger to see what’s going on.
You could add
return thisPath
inside the repeat, this would end the script at this point and you could see in Script Editor what’s passed to your shell script.
If necessary I sometimes add e.g.
display dialog thisPath as string
but that’s only needed if a script doesn’t work in another app after it already worked fine in Script Debugger.
Or you could try this code by @BLUEFROG to log AppleScript.
But I think in your case that’s all unnecessary as there’s nothing that could go wrong with getting a record’s path from DEVONthink. Also thisPath is already correctly wrapped in quotes by the quoted form of, that’s all fine.
So I’m afraid it’s your shell script that doesn’t work. I’ve only little knowledge of shell scripts, but if you post it I’ll take a look.