The reaction is written as below:
HCl + KMnO_4 -> KCl + MnCl_2 + Cl_2 + H_2O
This is an unbalanced reaction. Balance it so you have the same number of each element on each side by changing the big numbers in front of the molecules:
16HCl + 2KMnO_4 -> 2KCl + 2MnCl_2 + 5Cl_2 + 8H_2O
(If you don't know how to balance chemical equations, look here)
Now, the question is says we have 8.0 moles of potassium permanganate, KMnO_4 and 31.0 moles of hydrochloric acid, HCl.
In the equation, the potassium permanganate to hydrochloric acid ratio is 2:16 or 1:8 (looking at the big numbers in front of the molecules).
In the values of the question, however, the values are 8:31.
We know from the reaction ratio (1:8) that for every 1 mole of potassium permanganate, we need 8 moles of hydrochloric acid, but in the question's ratio (8:31) we do not have enough hydrochloric acid, so this is the limiting reagent. Reactions can only run as fast as their slowest member. Not all of the potassium permanganate will be reacted, but all 31 moles of the hydrochloric acid will react.
Now we need to find a new ratio, between hydrochloric acid and water, which is what you are trying to find. According to the equation, the ratio is 16:8, or 1:1/2. For every 1 mole of hydrochloric acid reacted, 1/2 a mole of water is produced.
We know that there are 31 moles of hydrochloric acid, so 31 * 1/2 = 15.5 moles of water are produced.