How to move 2 cube at the same time? New to Blender
Your code seems to work for me - one cube rotates around the other (which remains stationary at the origin). The only issue I can see with the code is that the initialisation to add the cubes refers to 'Cube' and 'Cube2' but the later logic refers to 'Cube' and 'Cube.001'.

I suspect the most likely cause of your issues is that you have run the script multiple time and, perhaps, an earlier copy of your code is still registered in the handler. Try saving your work (after changing 'Cube2' to match 'Cube.001'), closing Blender, and re-opening and running - and see if that resolves your problem.