Please post your code. It is quite difficult for anyone to understand what you're doing without it. Actually, can you list the process you go through to accomplish what it is that you wish to program, so we can all understand "EXACTLY" what it is that you want.
What do you mean by ending point of the first polyline entity and the starting point of the second polyline entity? Are these two separate, but connected entities or are you speaking of each vertice within a pline entity.
if the user is not digitized in the one direction this logic is not working .
Maybe the logic needs to be changed?
BTW, how proficient with lisp are you? Plines are not the easiest things for beginning lispers to grasp.