try adding a (setq d1) line for a distance then run the offset command in the lisp right after you have drawn the polyline.
(command "offset" (entlast) d1).
Maybe try something like that. You may still need to click on the inside of the object. Im still new to all this coding but try that.