I am struggling with a definition which should lead to the Lebesgue outer measure.
Theorem: Every open subset of $\mathbb{R}^n$ is a countable disjoint (with the meaning non-overlapping or the interior of two different squares are disjoint) union of closed squares.
The algorithm for generating these squares uses following definition: $$\mathcal{C}^{(k)}:=\left\{Q=\left\{(x_1,\cdots, x_n)\;|\; \frac{m_j}{2^k} \leq x_j \leq \frac{m_{j+1}}{2^k}\;,j=1, \cdots, n\right\}\;| \;m_j \in \mathbb{Z}\right\},$$ for $k=0,1,\cdots$
I do understand that the green area should be covered with non-overlapping squares which are getting finer and finer but I do not understand how the $m_j$ are choosen. Using this example:
How do I choose $m_j$ and $m_{j+1}$? Please feel free to draw into the example.

Hint.
I give you a way to do it in dimension $1$ that you can adapt in dimension $n \ge 1$.
Suppose that $U \subset \mathbb{R}$ is an open subset. As $U$ is open, for any $x \in U$, one can find an open interval $(y,z) \subset U$ with $y < z$ such that $x \in (y,z)$. Name $d=\min(\vert x-y \vert, \vert x-z \vert) >0$ and take $k \ge 1$ integer such that $\frac{1}{2^k} < \frac{d}{2}$.
Now name $m =\sup \{l \in \mathbb Z \ : \ \frac{l}{2^k} < x\}$. You have $x-\frac{m}{2^k} \le \frac{1}{2^k} < d$. Hence $$x \in [\frac{m}{2^k},\frac{m+1}{2^k}] \subset (y,z) \subset U.$$
Making the union of all those closed intervals from a countable set for $x \in U$, you're done.