Help remove unnecessary polygons when Creating a mesh using a Curve

Godot Version v4.2.stable.mono.official

In Godot . I use a 4 vertex from the CSGPolygon3D Node along the entire length to create a tunnel. I invert the polygons, then use Path3D which creates polygons from 4 vertex along the entire curve. The problem is that when the tunnel is created, at the end and at the beginning it is necessary to remove the polygons that overlap at the beginning and at the end of the tunnel. How do that?