Just guessing here but setValue requires a string. You are passing the raw string value. Imagine text contains Hello World. You're script is actually:
editor.setValue(Hello World);
You need to enclose the string in quotes.
await Editor.ExecuteScriptAsync($"editor.setValue('{text}');");