How can I programmatically save a block/group to a file or stream?
You can save the whole diagram using SaveToStream/LoadFromStream. You can copy/paste selected blocks to the clipboard using CopyObjectsToClipboard and PasteObjectsFromClipboard. There is also a library manager feature where you can add blocks and group of blocks to a library and reuse them as if they are new blocks. But there is no such a feature for saving a block to stream, and I wonder why would you need it given the existing features previously mentioned?
We want to create our own library of blocks and manage it by just saving the information of newly blocks/groups created within the diagram component. The user would be able to create its block for future usage.
Why don't you use the built-in library feature? That's the purpose of it, creating new blocks from existing ones.