Animating cameras focal length via python code
Your code works fine. But note that you are adding a new camera data when you
do bpy.data.cameras.new('Camera'). If there already is a Camera data, the new one you created will be named Camera.001. Make sure this camera data is assigned to your camera object.