How to insert the coefficients of a f-curve in Python?
I fail to get your example to run, which might be in part because I don't have that Keying Set Rent available, partly because it seems as if bpy.context.object in your code refers to the object and not the FCurve, so I don't know how it should access an attribute to the FCurve like use_restricted_range

Anyway, the attributes for the FModifierGenerator are
mode which is either POLYNOMIAL or POLYNOMIAL_FACTORIZED,
poly_order and
coefficients which is a list of length poly_order+1 for a polynomial or poly_order * 2 for a factorized polynomial.

The following code adds a keyframe to the X location of the active object and adds a function modifier generator with polynomial order and coefficients set.

import bpy

obj = bpy.context.active_object
obj.keyframe_insert(data_path='location', index=0)  # X Location

fcurve = obj.animation_data.action.fcurves.find(data_path='location', index=0)
mod = fcurve.modifiers.new(type='GENERATOR')
mod.mode='POLYNOMIAL'
mod.poly_order = 1
mod.coefficients = [2, 3]
mod.use_restricted_range = True
mod.frame_start = 0
mod.frame_end = 100


If your code runs in your blender, then adding something like bpy.context.object.poly_order = 1, etc., should do the trick. Otherwise you have to find the FCurve of your keyframe channel with the correct data path according to your keying set and and modify its attributes like above.