What you say is correct. The appointment letter itself is contract between employer and employee. However, to know the exact legal version, you may check contract act of your country.
As far as making employee to sign long-term agreement like five or ten years is concerned, it can be deduced that your company is looking for legal solution for the challenges arising out of shortcomings of your organisation's culture. People will quit the job and companies will have to live and grow in spite manpower attrition. At the same time, organisations need to take corrective measures to strengthen the employee retention. In one of my earlier replies, I have given exhaustive list on why employees quit the company. Click the following link to refer it:
Employees stay in the company when they have opportunities to grow and there is brand attractiveness. If you wish to discuss with me on this issue, feel free to call me on WA or Google Duo or Skype.
From India, Bangalore