What is the correct python code for pressing "I" and selecting LocRotScale?
You should avoid ops functions and use the object's attributes and method to achieve your goal. (Ops is slow and can even be context dependant.)

To insert a location keyframe, use the keyframe_insert method of bpy_structs with data_path parameter set to location.

Use the same method for scale, setting the data_path to scale.

In order to keyframe the rotation, you need to know the rotation mode. An objects rotation_mode can either be set to QUATERNION or EULER. The respective parameter values for the data_path parameter are rotation_quaternion or rotation_euler.

Below is a fully working example, given there is an object named Cube.

import bpy
import mathutils

selected_loc = [mathutils.Vector((x, 0, abs(x-5))) for x in range(8)]
moving_object = bpy.data.objects['Cube']

for i, loc in enumerate(selected_loc):
    bpy.data.scenes["Scene"].frame_set(i * 4 + 1)
    moving_object.location = loc
    moving_object.keyframe_insert(data_path = 'location')
    if moving_object.rotation_mode == "QUATERNION":
        moving_object.keyframe_insert(data_path = 'rotation_quaternion')
    else:
        moving_object.keyframe_insert(data_path = 'rotation_euler')
    moving_object.keyframe_insert(data_path = 'scale')