As tom_l said before, your best bet is to use a Helper. Storing data for the user is exactly what Input helpers, like the Input Text that Tom recommended, are for.
In HA, YAML Variables only have local scope… in this case since you have defined it in the Action block of an automation, it only has value inside that block, in that specific automation… it will never be available in a dashboard card.
It is possible to define custom macros and use them kind of like a global variable.
Finally, be aware that most dashboard cards do not accept templating, so the usefulness of the custom macro method will depend on the card type you are using… We could likely provide help that is more specific to the situation at hand if you provide more details.