A mahlstick is a tool to provide support to the painting hand.
It’s a stick with a soft ball on one end. You can lean the ball on the painting or lean it on the edges of your canvas or easel. This leaves a little space between the stick and your painting. Now you can lean on the stick with your wrist (or your arm) and easily paint controlled and precise.
The piece of cloth that’s wrapped around the ball prevents the ball from scratching your painting.
The mahlstick is especially handy when you’re painting lots of details. Your hand is supported and that way you have more control. Of course it also helps preventing getting tired quickly.
You can buy mahlsticks, but a lot of people make their own sticks. There are also many painters who use a cane. They hook the cane around the edge of the canvas or easel.
I sometimes use my t-ruler, that works just great as well!