please check my code it is only working for 1 table the loop is not repeating