Changing the position of the camera using python script and then rendering using the new location

Hello, I am trying to use the classroom scene from the following link: https://www.blender.org/download/demo-files/
with some modifications for mist pass following the link: https://blender.stackexchange.com/questions/238218/getting-the-depth-of-every-pixel-to-the-center-of-projection-of-the-camera-in-bl

I am taking inputs from the user using a JSON file and trying to change the location of the camera accordingly. The following is a snippet from the same:

“camera_locations”:[
[
1,
2.576395273208618,
-4.465750694274902,
1.094475507736206
],
[
2,
-1.87639527320862,
-1.465750694274902,
2.094475507736206
]

I am later converting this into a dictionary (within the python script) and using the same to change the camera location. However, on rendering the images I see identical images.

I have created a function wherein I pass the camera object and the camera locations as the parameters. On running the below lines of code I can see the camera location changing

`for k,v in camera_locations.items():
                print(object.name)
                object.location=v
                print(object.location)
                *#scene.render.filepath=output_path+str(i)
                #bpy.ops.render.render(write_still=True)*`

but when I add lines to render the image I see identical images (i.e when I uncomment the lines above). Essentially I do not see the rendering with respect to the changed camera position. I am unable to understand why. Can someone help me with this?