I had never got this to work either. But, spurred on by it being someone else's problem rather than something I'd just work round...
I think the copied macro XML is missing important information needed for an import -- specifically, the Macro Group to import into. You attempt, and my previous, has the XML as eg:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Actions</key>
...etc
<key>UID</key>
<string>50601C6C-2969-4A24-ABF8-636F6D4F1826</string>
</dict>
</plist>
Comparing that with @peternlewis's template in his "Create Text Expansions Macro":
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<key>Activate</key>
<string>Normal</string>
<key>Macros</key>
<array>
<dict>
<key>Actions</key>
...etc
</dict>
</array>
<key>Name</key>
<string>Text Expansion</string>
</dict>
</array>
</plist>
...and we can see the extra lines required and where to inject them into your copied XML. You'll need to change the name for the Macro Group, obvs
Try this -- Group Name to import into is stored in the first action:
TEST Export and Import Macro via XML - via AppleScript v2.kmmacros (5.2 KB)