Since the questioner really wanted to invoke lineto/moveto, thefollowing might be more appropriate:
/drawto { {lineto} stopped {moveto $error /newerror false put} if} bind def
This is (slightly) less subject to stack overflow, and quicker.
-- Rich