Add a checklayer defun before setting the current layer. This includes color and linetype.
(defun chklay (lay col lt / )
(if(not(tblsearch "LAYER" lay))
(command "-layer" "m" lay "c" col lay "lt" lt lay "")
(princ "exist")
)
(setvar 'clayer lay)
)
For me I use a dcl for questions. If you want it ask.