If you are employing undergraduates and wish to give them a three-year timeframe to complete their graduation, you may mention this condition in the appointment letter itself. There is no need to create a separate legal agreement beyond the appointment letter, as the appointment letter serves as a contract under the provisions of the Indian Contract Act, 1872.
Furthermore, you may appoint them with a "Fixed Term Contract" (FTC) for a term of three years. You can specify that the extension or conversion from FTC to permanent employment would be contingent upon the completion of their graduation within this period.
Thanks,
Dinesh Divekar