I don’t know if this is the only issue but you’re get the variable “string” but not it’s value. You can get the value with a 2nd variable or add getAsString to the line with the function call.
// for testing, the first example adds an x to the value, the 2nd an "o"
let myVar = runtimeScene.getVariables().get("myVarText");
let v = myVar.getAsString()
myVar.setString(v + "x");
let myVar2 = runtimeScene.getVariables().get("myVarText");
myVar.setString(myVar2.getAsString() + "o");
FYI, you can’t add .getAsString to the first line because you still need that to set the variable. That’s why you need either a 2nd variable or add .getAsString
Here’s a good post about variables. It’s an old post. From what I’ve read let is better than var