I want to setup a stop condition on For Each Loop node to work more like a "While Loop" way, (do the loop until a condition change); but I can't get to work with an attribute that dynamically updates inside the loop (as would work on VEX).

A bit of context:
Basically what I want is that dynamically and randomly, Houdini creates a bunch of lines connecting some points under certain rules.
Here's a kind of algorithm.

The idea is to repeat this, to draw N random lines that I want.
I have pretty much of the job done, but there are two key moments when I need this "While loop".
The first of them is to limit the amount of Orange Points connected before connects Pink Point, and this would be doing the loop only until the distance between the last Orange point and the Pink Point be less than N float number.
The second, is to serve as amount of lines to draw; do the loop until N lines are actually drawn.
For accomplish this, I created two detail attributes that updates inside the loops but I can't get to set them as Stop Conditions for Loops
I upload the hip file
Image Not Found
I'll appreciate any help.