added code for finding intersact node in two list and correct the loop l...

...ogic