How to pass a variable to "do shell script" in Execute Applescript action?

It would be very helpful to upload your actual macro so we can see it to help debugging.

For one thing do shell script is AppleScript language, so if you are using Keyboard Maestro's Shell Script action, then you do not want to use that.