I need to repair a loose railing that is anchored in cement.

To repair the hole in the cement where the anchor is, use a special anchoring cement that is quick setting and is stronger than concrete.