Have you read the Dynamo DesignScript documentation: Dynamo DesignScript Learning Resources
I would start there and create a really simple while loop then scale it up. Just reviewing your code (also, please post a copy of your code as you’ll get more answers):
-
LI
instantiation appears to be wrong, useLI={};
-
P=List.AddItemToEnd(P,LI)
is also wrong as you are assigning a list object to P (which is a Polycurve). You should be adding this to LI - Returning LI with nothing assigned to it will return…nothing!