Is there a way to add a game to a Category/Collection via the console?

No, the Steam client console (and SteamCMD it's based on/built from) don't have that functionality.

Steam/steamapps/libraryfolders.vdf (inside the Steam installation folder) will have the Steam Library Folders listed and makes it possible to easily find your non-default steamapps folders programmatically no matter where they are without using hard-coded paths (so, a more friendly script is possible).

The appmanifest files, that you already know about, will be in the steamapps folder of the directories listed in libraryfolders.vdf. 0 is considered the default folder in Steam/steamapps and so extra folders in libraryfolders.vdf will start at "1".

.VDF files can be text-based, like sharedconfig and most other config files, or binary. The binary format isn't worth trying to explain without using code, but the text format is like a crappy version of JSON where everything is just in "object" notation, no [lists] and 2x tabs (\t\t) separate key and value:

"object_key"
{
  "property"\t\t"value"
  "a"\t\t"0"
  "B"\t\t"true"
  "8675309"\t\t"numbersCanBeKeysToo"
}

From there, I'm guessing you know what to do. While you're doing all this it wouldn't be a bad idea to create a backup system for your sharedconfig.vdf file as it can be destroyed seemingly "randomly".

If you need some code inspiration the original Depressurizer (in C#) is no longer maintained, but has the basis of everything needed, and there's similar code in Java, JS, Python, and etc other languages on GitHub.

I was working on (badly) documenting all the possible Steam client options and their values at Steam-Data, and a library based on using that and data scraped from the web to modify the Steam client settings. My PC died though and the project has not been maintained though I tried to get Steam to install on a CI to continue the work. The settings library is at node-steam-config with another attempt at SteamConfig if you're interested in that code at all, but note that it's likely very broken as it's been almost 2 years.