Missing a few steps there, and some needed information.
Most importantly: do you plan on loading the family back into the project, or saving it to a library?
Have you tried anything with Dynamo yet?
If not have you searched the forum, as there are some good examples you can build from such as this: Change a selection of families categories in a project - #3 by sovitek