Dear Niketan,
Inter-Company transfer of employees at the behest of employers among their group companies ( " Group Company " itself is a misnomer for there is no such a term defined under the Companies Act for each and every company registered under the Act is a separate legal entity ) is an issue warranting more vigilance on the part of the transferred employees. Such employees should ascertain before transfer whether they are transferred with continuity of service, pay protection, seniority etc., and whether there is provision for such inter-company transfers in the standing orders or service regulations and whether the transfer is effected with the consent of the transferee company. If they get no answer in writing or the transfer order is devoid of such particulars, they should not accept the transfer. In such a situation, one cannot say anything on the issue raised by you without going through the transfer orders, standing orders or your letter of appointment issued originally by the transferor company.
Still you can do one thing. Send your notice of claim in form I to both the companies. If they fail to respond or disown the liability to gratuity on the grounds already indicated in your post, file a joint-claim for gratuity against both the companies before the Controlling Authority for the area where you worked last.