Doubt regarding Cantor's diagonalization argument
There are several issues with your question but perhaps I can clarify some issues.

First off you assume $f(1) = 1.999...$ and also that no $x \in \mathbb{N}$ exists such that $f(x) = 2$ but that's a contradiction in terms because $1.999... = 2$ and thus $f(1) = 2$.

Why does $1.999... = 2$? Well there's an easy answer but not fulfilling answer and a more complicated answer that I find satisfactory. The easy answer is that $1 = \sum_{i=1}^{\infty}9*10^{-i}$ (the general form $(N - 1)*N^{-i}$ holds for all $N$) and $0.99...$ is definitionally $\sum_{i=1}^{\infty}9*10^{-i}$

A more satisfactory answer comes from understanding the representation of real numbers as you would in an analysis class and understanding when we define two real numbers to be equal. There are many different representations and I'll get details wrong here if I try and give you a precise example but the basic idea of most representations is to represent a real number as a sequence (sometimes its not a sequence but generally) of finite (generally rational) approximations. So $[1/1, 1/1, ...]$ is a real number representing 1.0 and $A = [9/10, 99/100, 999/1000, ...]$ is another that as we shale see is equivlent. Notice that the terms in that are the finite sums of $\sum_{i=1}^{\infty}9*10^{-i}$. We define the summation to be the sequence of its finite summations. If the sum converges then this defines a valid real number. Why does $[2/1, 2/1, ...] = [19/10, 199/100, ...]$? Because for any $\epsilon &gt; 0$ I choose you can find an $N$ such that the difference of the $N$th elements of each sequences is within $[-\epsilon, \epsilon]$ or in a nutshell, the approximations become arbitrarily close. Take this paragraph with a grain of salt though, I'm being handy wavy and imprecise.

The traditional proof of cantor's argument that there are more reals than naturals uses the decimal expansions of the real numbers. As we've seen a real number can have more than one decimal expansion. So when converting a bijection from the naturals to the reals into a list of decimal expansions we need to choose a canonical choice. The axiom of choice just lets us do this for free but it sounds like your book tried to do something different. It isn't clear to me what your book did exactly from your description. Here's a potential way but it relies on further knowledge of reals and decimal expansions.

Take for granted that only the rationals with terminating decimal expansions (e.g. not 1/7 or 1/3 but 1/2 = 0.5 and 1/8 = 0.125 etc.. are valid) have two representations. Then its clear that every real number has exactly one non-terminating representation. So for our decimal expansions if we restrict ourselves to the non-terminating expansions we have no ambiguity.