Apart from the (real) possibility that they (PTC) didn't think that users would actually want to use WRITETEXT in a program (nothing in the help files indicates, let alone describes how, you could use it in a program):
I see no error (message) in the picture you provided. Please provide (also) a worksheet.
You only defined the 'check' variable in terms of a (little) program.
In order to actually execute the WRITETEXT function in that little program, it must be evaluated. Did you try evaluating check yet?