If statement in the for loop

can please help me for the problem in below link....

https://community.neo4j.com/t/how-to-extract-relationships-from-shortest-path-algorithm/14377