How to keyframe_insert without moving the object
You can surround your code with something like:

current_frame = bpy.context.scene.frame_current

obj = bpy.data.objects['Cube']
obj.keyframe_insert(data_path='location', frame=0)
obj.location.z += 5
obj.keyframe_insert(data_path='location', frame=100)

s.frame_set(current_frame)


So that the current (or the frame you want) is restored once the key frames are inserted.

Though, that does not guaranty that the object will not move, as its movement is dependent on the key frames you have set.