Using custom vertex data in render
As far as I know, only special custom data layers can be used in a render or the 3D view:


Loop UV
Loop colour (i.e. vertex colour)
Vertex defom (i.e. vertex groups) - but only indirectly, e.g. as deformation


If you want to see your data in a render, you need to transfer it to a UV layer or vertex loop colour layer first. To transfer to a colour layer, you can do something like this:

color_layer = mesh.loops.layers.color.new('Foo')
for vert in mesh.verts:
    val = vert[my_cdata]
    col = (val, val, val)
    for loop in vert.link_loops:
        loop[color_layer] = col


Then you can use the 'Foo' layer in a render.

Note that val will be automatically clipped to be between 0 and 1.

When transferring to vertex colours you will lose precision, because each channel is stored in a single byte (whereas float custom data is stored in 4 bytes). You can get better precision by using a UV layer, which stores floats - but only two channels (x and y). When using a UV layer, the values will not be color-managed; this can be useful or not, depending on your material. Storing in a UV layer is similar:

uv_layer = mesh.loops.layers.uv.new('Foo')
for vert in mesh.verts:
    val = vert[my_cdata]
    for loop in vert.link_loops:
        loop[uv_layer].uv.x = val