When you try to join two lines using pedit, it expects two ends to meet at a point, if they don't then it won't join them. It does however allow a fuzz factor. This is the amount by which two ends can differ but be accepted as the same i.e. a small gap between the ends of lines. Increasing the fuzz factor (making it larger) allows for bigger gaps but may alter the order lines are added.
I have set it at 1.0e-6 (0.000001).
Actually I also wanted to add one more function in that lisp. I want to convert those exploded vertices back into polyline. Is that possible? Because after doing spline and explode,vertices in line will increase. For example 30 vertices will become 150
Not sure I fully understand what you want. If you just want a polyline then don't explode it, it is a still a polyline object with spline fit curves, not a spline object.