How to organize points according to branches that are formed in different ways

hi! i was wondering if someone could give me a hand with an issue im having.

I have 3 different geometries that contain points. All of the points should come together in branches so i can use a final polyline. The idea is that i should be able to do it without being so manual, but im not sure exactly what the problem is when i try to do it, i know there are some points who are in wrong branches for example.

Thanks! (95.0 KB)