@paliwal222
Here is your lisp. I hoped that you'll try to write down some code. Option with command TCOUNT is in my opinion more versatile.
(defun c:textAtPolylinesIntersection ( / take pointlist3d get_intersections textheight ss i in int_pts lst eo fo)
(defun take (amount lst / ret)(repeat amount (setq ret (cons (car lst) (take (1- amount) (cdr lst))))))
(defun pointlist3d (lst / ret) (while lst (setq ret (cons (take 3 lst) ret) lst (cdddr lst))) (reverse ret))
(defun get_intersections (obj1 obj2 / var)
(setq var (vlax-variant-value (vla-intersectwith obj1 obj2 acExtendNone)))
(if (< 0 (vlax-safearray-get-u-bound var 1))(vlax-safearray->list var))
)
(setq textheight (getreal "\nText height > "))
(setq ss (ssget '((0 . "LWPOLYLINE"))) i -1 int_pts nil lst nil)
(while (< (setq i (1+ i)) (sslength ss))(setq lst (cons (vlax-ename->vla-object (ssname ss i)) lst)))
(while (and lst (> (length lst) 1))
(setq eo (car lst) lst (cdr lst))
(foreach fo lst
(setq in (get_intersections eo fo))
(if(and in) (setq int_pts (cons (pointlist3d in) int_pts)))
)
)
(setq int_pts (vl-sort (apply 'append int_pts) '(lambda (x y)(< (car x)(car y)))))
(setq i -1)
(while (< (setq i (1+ i)) (length int_pts))
(entmake
(list
(cons 0 "TEXT")
(cons 100 "AcDbText")
(cons 10 (nth i int_pts))
(cons 40 textheight)
(cons 1 (itoa (1+ i)))
(cons 50 0)
)
)
)
(princ)
)
Here is how to use command TCOUNT that I proposed in Autocad forum. It gives you option to select desired direction, prefix,suffix.... After using lisp you steel have to realign text entities away so they don't intersect with polylines and other entities in your drawing.

Command: TCOUNT
Initializing...
Select objects: Specify opposite corner: 11 found
Select objects:
Sort selected objects by [X/Y/Select-order] <Select-order>: x
Specify starting number and increment (Start,increment) <1,1>:
Placement of numbers in text [Overwrite/Prefix/Suffix/Find&replace..] <Prefix>: o
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.