I'm not sure that an action is necessarily the best option for you. A script could do something like this fairly easily. This should give you some useful pointers as far as basic scripting goes..
Basically, the script has to do a few things. First, get the layer dimensions and save them as a variable. Then, make a new text layer, and use the variables as that text.
Below is the basic skeleton of the script:
function run(){
var layer = activeDocument.activeLayer; //Grab the currently selected layer
//Calculate length and width based on the rectangular bounds of the selected layer
var length = layer.bounds[2]-layer.bounds[0]; //Grab the length
var width = layer.bounds[3]-layer.bounds[1]; //Grab the width
//Create a text layer
var textLayer = activeDocument.artLayers.add(); //Make a new layer on the canvas
textLayer.kind = LayerKind.TEXT; //Make that layer a text layer
textLayer.name = "Dimensions"; //Name the layer "Dimensions"
var textReference = textLayer.textItem; //Create a textItem which we'll use to fill the text layer
textReference.contents = "Length: " + length + " Width: " + width; //Set the contents of that textItem to the length and width
}
run();
You can run this by copying and pasting this code into a file named "dimensions.jsx", then going to File->Scripts->Browse and navigating to that script.
Below is "proof" that this works - I created a new layer named Layer 1, and selected it. In the "Info" panel, you can see the length and width listed. I then ran the script, which created a new layer named Dimensions, whose text contents are the same length and width presented in the Info panel (without the rounding).

Let me know if you have any other questions!