What's Wrong with My Python Script?
You should probably define an operator. See Python example files that come with Blender about how to write an operator:



It might be a good idea to change objects location directly instead of using an operator that is for user interaction. You can change the location of the active object by changing bpy.context.object.location values.