I think you simply want to use a shape layer's path as a path for your text to follow.
If there is no scaling applied to the shape layer then you can copy the path by setting a keyframe for it then start a mask on your text layer using the pen tool and putting the first point anywhere and then doing a paste. You can now reveal the text layer's properties and set the path options to the new path. This works best if you use the pen tool to draw your shape layer path, then add a text layer using New>Text Layer and typing the text. If you just click in the frame and start typing or you move or scale your shape layer you will run into position problems because the paths will not line up.
If you use the shape tools (rectangle, polygon, etc.,) you will have to convert the shape to a path before you start. You can do this by right clicking on the path. Here again, if your path is not in the center of the comp you'll have position problems that you will have to adjust. The most efficient workflow if you were using the shape tools would be to hold down the Alt/Option key before you start dragging out your shape so that it creates a bezier path instead of a shape. This would solve position problems. If you have already created the shape layer with a shape tool then center it in the comp and parent the shape layer to the text layer so you can reposition them both later.