The problem is that you are using get_field('repeater')
inside the loop for the repeater while(have_rows(repeater'))
which is confusing the while loop. If you want to get the. If you want to get the entire repeater as an array then you need to do this outside of the while loop.