If we consider this as your polymer file:
<polymer-element name="my-custom-element" attributes="key" hidden>
<script>
Polymer({});
</script>
</polymer-element>
and here is the link importing the file in your html:
<link rel="import" href="../my-custom-element/my-custom-element.html" key="15">
There are a few approaches to achieve what you are asking for...
If you want to generate that value dynamically, then one way is to create a constructor for the custom element like this:
<polymer-element name="my-custom-element" constructor='MyCustomElement' attributes="key" hidden>
<script>
Polymer({});
</script>
</polymer-element>
Afterward, you can instantiate such an element within the code of the polymer element, for example:
var custom = new MyCustomElement();
Insert this element into your DOM like so:
var dom = document.querySelector('otherElement'); //depends on scope
dom.appendChild(custom);
custom.setAttribute('attribute', value);
or
this.$.elementID.appendChild(custom);
custom.setAttribute('attribute', value);
I hope this aligns with what you need. Cheers!