python script to move bone using "G key"

I want to move a bone from point A ( x1,y1,z1) to point B( x2,y2,z3) - similar to “press G key” - which has an IK solver so that when you move the wrist the whole arm follows the wrist. Using python script and keyframes.

Something like this

for pbone in pbones: # set bones to no rotation
pbone.loc[:] = 0.000,0.000,0.0000
pbone.insertKey(arm_ob, frame, Object.Pose.LOC)

# Set a different rotation at frame 25 
pbones[2].loc[:] = 1.000,-0.2000,-0.3000
  
frame = 25 
for i in xrange(3): 
    pbones[2].insertKey(arm_ob, frame, Object.Pose.LOC) 

frame = 50       
for pbone in pbones: # set bones to no rotation 
        pbone.loc[:] = 1.000,0.000,0.000,0.00 
        pbone.insertKey(arm_ob, frame, Object.Pose.ROT) 
frame = 1