The handle on a car roof is typically used for one of two purposes: to open the sunroof or moonroof, or to provide a point to grab when closing the car door.
On most cars, the handle for the sunroof or moonroof is located in the center of the roof, just above the headliner. The handle for closing the door is usually located on the outside edge of the roof, near the base of the A-pillar (the structural support that runs from the front of the windshield down to the top of the front fender).
There are a few exceptions to these general rules. Some cars have handles on both sides of the roof, while others have them only on one side. And some cars don't have any handles at all - you just have to grab onto something else like an overhead grab bar or assist strap.
But regardless of where they're located, all roof handles serve essentially the same purpose: to give you something solid to hold onto when you need it.