Your question is too complex. That is why I will feel wrong if I will give you full answer. Because i do not want to do your jobe instead of you.
But i dislike that many people underestimate geonodes, even now when geonodes are very close to become more powerfull then old blender addons like sverchock or sorcar. In fact, geonodes have already surpassed sverchok and sorcar in several tasks. And they will become even more powerfull soon, because they have better blender integration and better support.
That's why i want to show that it is absolutely possible to do something like that in geonodes.
Here is solution for connecting 1 yellow ball to 1 closest red ball. And to connectig 1 red ball to 1 closest yellow ball. Also my node setup avoid situations when red line and yellow line have identical position and shape. In this case my node setup add a bend to booth lines, and create some kind of double bonds, like in molecule ball and stick models.
The key for this solution is comparing of positions of points between two point clouds. For this I use transfer atribute for target point cloud, and capture atribute for acting point cloud.
All setup:
Inside Ball_Gen group:
Inside Line_Gen group:
Inside Line_Cleanup group:
Larger result view: