For booking and cancelling Indian Railway ticket you always require a railway reservation form. These forms are normally available at booking counter, but in case you might not get the form there you can always download the reservation from here.
With this form you can book or cancel the tickets at your ease. Fill the form with all the necessary details mentioned.
The form will look like the following image.
My advice here to at least download and print 4 to 5 forms, which will help you to book tickets in multiple trains, if the reservation is not available in your desired train.
You can always access the official railway site to directly fill and print the form.