A toilet paper holder that twists or pulls away from the wall usually fails at one of three points: the screw holding the trim to its plate, the plate screws, or the anchor inside the wall. Finding the moving point keeps a small repair from turning into an ever-larger hole.
Hold the bracket and locate where movement starts
Move the holder gently while watching the base. If the decorative cover moves on a plate that stays firm, look for the set screw. If the entire plate pulls away from the wall, the problem is in the screws or anchors.
Tighten the plate only if the screws still grip
A screw that still offers resistance can be snugged carefully. If it spins without tightening or loosens again, the anchor has failed. Continuing to turn it can enlarge the hole and make a clean repair harder.
Replace the anchor for the wall type
Drywall, plaster, brick, and tile do not necessarily use the same fastener. On tile, do not drill without knowing what is behind it, and avoid tools or anchors that can crack the tile. Fastening into a stud or other solid backing is preferable when available.
Make sure the arm is not levering against the wall
Once reassembled, the holder should sit square and without play. If a long arm is being used for support when standing up, that load exceeds its purpose; install a properly anchored grab bar designed for body weight instead of reinforcing the paper holder.