Placing hanger by python code

I have created a dynamo to place the hangers for rectangle ducts. it is perfectly working for one duct. if I select two ducts, code not entering to the second duct. it will be very helpful to me if anybody can find the mistake in the code. I have attached the dynamo and family of hanger. i am not interested to use the node. i totally written this in python.hanger.dyn (36.8 KB) sh_rec_hanger_type-1.rfa (340 KB)