you have mild gastritis
and usually it may be because you would have had spicy food or may be during stress
also. the medicine given are correct, next time you can take those medicines it is not a problem but do not take for long time without consulting the doctor and for controlling gastritis do the following.
improve you lifestyle,wake up and sleep on time , do not sleep very late and sleep within an hour after having dinner.
cut down on spicy food and try eating curd on regular basis.
eat more fruit and vegetable and reduce non veg.
if you follow these step i am sure you will not require medications
also i would like to add that you deworm yourself.