modified for loop for tomcat build

modified