You are very close. You just need to tell KM Engine like this:
tell application "Keyboard Maestro Engine" to set KMVAR_classetag to getvariable "KMVAR_classetag"
For more info see Using AppleScript with Keyboard Maestro .
In the future please put your scripts in a Code Block. I fixed your post for you this time.