Veeresh,
The power dissipated in the device is VIN*ICC+(VIN-VOUT)*IOUT = 12V*5mA+7V*250mA = 1.81Watt
The heat needs to flow easily into the printed circuit board then the PCB conducts heat to ambient air.
If the tlv1117 is too hot then the PCB is too hot or the PCB does not accept heat from the tlv1117 well.
There should be a good thermal path from the copper under the tlv1117 pad to the PCB ground plane.