Move Array Push outside the second for loop