That works but not exactly what I was looking for.
( actually used that first only slightly differant)
(while (< 0 (getvar "cmdactive"))
(command)
)
But what I would like is to stay in the xline command until the user wants to exit,while still maintaining the correct layer.