So I am giving it a try and first problem is that it is saying subcategories can only be accessed within a family doc, so feeding it your list of lines wouldn’t work. I didn’t expect it to work to begin with since the lines you have are not the Revit family lines but just Dynamo elements based on the curves. Meaning the lines you have selected has no connection to the generic model besides being in the same place, no data or anything.
So instead, you would have to feed it a list of families, open the family docs, select the lines, use the Subcategory method, then return the subcategories.
If you are trying to use this script to filter those lines you see in Dynamo, I don’t think it will work like that.