Consider this:
newCubes = [cube1, cube2]
oldCubes = [cube1]

cube1 is found in oldCubes by the inner loop, so movedIntoBlock is set to false... and can't be set to true again, despite the presence of the next element.