Some of your concepts are backwards - change them and see if that helps.

Variable assignment of strings needs to be quoted -
$X = '\\server\'
not
$X=\\server\

and variables should NOT be inside quotes
$NewSrv$Ptr ?
not
? "$NewSrv""$Ptr"

Minor - the "?" is a shortcut for a CRLF sequence and should generally come at the end of output, unlike BASIC, where it is a shortcut for the PRINT command and comes first. In Kix, it works either way, but you'll see a problem when you create output that's used elsewhere, often with a leading blank line and no closing CRLF.

Also, the GOTO END serves no purpose other than to use a "forbidden command" (GOTO's are BAD!). Function declarations don't need to be "skipped over" the way you have coded.
Glenn
_________________________
Actually I am a Rocket Scientist! \:D