of course you can assign a material ID to a single element, and you could use the element ID; here's how I see it working ...
Element 1234 would have some nodal connectivity and a property ID, say 1234.
Because you're using solid elements the "property ID" could be a material ID, since there is no geometry to be defined.
So define material ID 1234 with what ever properties you want.
Generating these properties seems like the difficult, labourious, part. To generate the file, I'd probably use something like excel (since I don't know python, or API, or the such). It would be easy to export the analysis model (the FEA input deck), which could be a simple as a set of nodes and a set of elements. copy the set of elements and update (you only want the element number). I don't know how you're generating propertied, but one way would be CG distance from a datum plane, and you could calc the CG from the 4 nodes on the element.
"Hoffen wir mal, dass alles gut geht !"
General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.