hi,
You can add xdata (as extension dictionary) to any AutoCAD object (graphical entities, symbol table records (layers, block definitions, ...), dictionaries).
But xdata added to a block definition won't be copied in the block references (inserts).
Thanks gile : That was the conclusion I came to ... something I wasn't explicitly aware of.
@ velasquez
The code you posted seems to be fine for making the block definition and adding the xdata to the definition.
You may be able to read the xdata from the definition and add it to the insert ( reference ).
Unfortunately this will mean that ONLY the inserts that use your routine will be fully compliant with your requirements.
As usually happens here, the responses posted offer alternatives to the question you asked. ( and to ones you didn't ask )