I'd like to illustrate my question with an example:
Imagine nickel reacts with fluoride and you start with $0.766\ \mathrm{g}$ of nickel, an unknown amount of fluoride and you end with $1.261\ \mathrm{g}$ of nickel fluoride. The mass of fluoride in the end must then be $1.261\ \mathrm{g} - 0.766\ \mathrm{g} = 0.495\ \mathrm{g}$.
So, in the end, there are $0.013$ moles of nickel and $0.026$ moles of fluoride. Now the question is, what is the empirical formula for nickel fluoride? ($\small\ce{NiF2}$). I see that for every mole of nickel, you need $2$ moles of fluoride. Then why is the empirical formula $\small\ce{Ni2F4}$ incorrect?