Wall creation using Spline system

So I want the ends of the wall to connect properly without any gaps as such, also the

thickness of the wall to be the same throughout.

But here there are some gaps between the ends of the walls, also there is thickness difference between the walls. Where the walls are thin at some places and of a different thickness at few places.

The wall creation is also happening from one end only not the other end.

Can someone tell me what’s wrong with my code?

The wall creation is also happening from one end only not the other end.

That is only from right end of the wall.

Here are the scripts.