When I try to set the level for Duct fitting or pipe fitting using python, I'm getting a error saying the parameter is read only, can someone help me with this

The LookupParameter() method returns the first match it finds. In this case, DuctFitting elements actually have two “Level” parameters. The first one is the schedule level, which is read-only, and the second is the associated level that you’re looking for.

To get the specific parameter that you’re after, you can use the BuiltInParameter method instead.
element.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM)

If you use the standard Dynamo nodes this would get handled automatically.