If the last dollar spent on commodity X gives him less marginal utility, he will withdraw this amount from X and spend it on Y if it gives him higher marginal utility. Here consumer how can consumer withdraw amount from x and spend it on y?
I think the problem is with the tenses. All the analysis is made before actual transactions take place. We are evaluating an hypothetical situation: A consumer considering buying a bundle $a=(x_1,y_1)$ realizes that if she did, the marginal utility of the last dollar spent on $x$ would be lower than that of the last dollar spent on $y.$ We observe that switching expenditure from $X$ to $Y$ would result in larger total utility. And since we expect consumers to maximize their utility, they will do so. This results in the consumer withdrawing part from the expenditure in $X$ and spending on $Y$ with respect to the hypothetical bundle $a$