The error you are getting is because of the inputs on the NewFamilyInstance()
method; that is an overloaded method (meaning the method can be executed with various different inputs). See the list in the API docs; the script is throwing an error because your first two inputs match the following: NewFamilyInstance(XYZ, FamilySymbol, StructuralType)
Try replacing your level input with the View to use the NewFamilyInstance(XYZ, FamilySymbol, View)
method.
Here is a good explanation of what “ToDSType(False)” is doing in your script