What method should I adopt to have my food while travelling in Indian train?Carrying food everytime is not very convinient especially lunch and dinner.
You have many options when it comes to food, you will never go hungry in Indian trains (unless you can't afford to pay or if you choose not to).
Firstly, most if not all long distance trains have a pantry car, typically an attendant will make the rounds and take food orders for breakfast, lunch and dinner. Here's the official IRCTC menu, note that this will differ based on the routes but this should give you an indication of the options available and the price.
Secondly, the long distance trains typically make somewhat long stops (30 mins to an hour) during the journey on the bigger junctions, you can take this time to venture on the platform and grab a bite. You can get refreshments at even the smaller stations (Tea, biscuits, snacks etc)
Thirdly, at these junctions or the bigger stations you can even order from places like Dominos or local restaurants that deliver. I've not personally tried this and can't vouch for the effectiveness or availability.
Lastly, in the premium trains like Shatabdi and Rajdhani expresses the cost of the meals are included in the price of the ticket.
In most trains, you also have hawkers and vendors selling soft drinks, chips, tea/coffee and the like from time to time during the day.
If you have allergies or dietary restrictions or are concerned about the health/hygiene of the food, then you can also bring your own food.