Man, you don't need any loops or other "hacks". Just use correct xPaths, they are really usefull!
I've opened issue on github with suggestion about fixing most horrible thing in your program.
Hope it'll help you with handling more data (37 if-else statements with same code weird af).