(defun c:TEXTOUT ()
    (setq fn (getstring "\nEnter the text file name: "))
    (setq x (open fn "r"))
    (setq re 0)
    (if (/= x nil)
        (progn
          (prompt "\nFile: ")
          (princ fn)
          (setq ans (getstring " exists, overwright [Yes/No] <No>: "))
          (if(or(= ans "no")(= ans "")(= ans "n")(= ans "NO"))
             (setq re 1)
          )
       )
    )
    (if (= re 0)
        (progn
          (setq x (open fn "w"))
          (prompt "\nSelect the text in order: ") (princ fn) (princ)
          (setq i 0)
          (setq s (ssget))
          (setq l (sslength s))
          (repeat l (setq text (cdr (assoc 1 (entget (ssname s i)))))
                    (write-line text x)
                    (setq i (+ 1 i))
          )
        )
    )
    (close x)
)
