LM317T not working properly?
It's a linear regulator. It can only decrease voltage, cap it, as you've said. It is working appropriately as you've described it.

If you want to be able to go up or down from the input voltage you need a buck/boost topology.