Union of sets as the union of disjoint sets - Does the proof $\forall n\in \mathbb{N}$ implies the proof for infinity?

I managed to prove that:

$$\displaystyle\bigcup_{i=1}^n A_i=A_1\cup(A_1^c\cap A_2)\cup(A_1^c\cap A_2^c\cap A_3)\cup\dots\cup(A_1^c\cap\dots\cap A_{n-1}^c\cap A_n)$$

for $\forall n \in\mathbb{N}$. Does this automatically proves that:

$$\displaystyle \bigcup_{n=1}^\infty A_n= \bigcup_{n=1}^\infty (A_1^c \cap\dots\cap A_{n-1}^c\cap A_n)$$

If not, what am I missing? Thanks for helping!

The second statement is true, and you can certainly use the first statement to prove it - but it's wise to be careful when you extend anything to infinity. You could notice that, as you have proved, for finite $k$ it holds that $$\bigcup_{n=1}^kA_n=\bigcup_{n=1}^k(A_1^c\cap \cdots\cap A_{n-1}^c\cap A_n)$$ then, since, when $k$ is infinite, we are just taking the union of all the above sets (that is the sets $\bigcup_{n=1}^kA_n$, not directly the $A_n$ this time), clearly the infinite unions are equal, since every member thereof is.
However, it'd probably just be easier to prove that, if $x$ is an element of $\bigcup_{n=1}^{\infty}A_n$, then there is some least $i$ such that $x\in A_i$ and then it follows that $x\in (A_1^c\cap \cdots \cap A_{i-1}^c\cap A_i)$ - which proves the theorem directly (for any sequence of sets $A_i$ with any well-ordered set of indices), and I imagine is similar to how you proved the finite case - so that might be a more elegant way to do it.
$$\cup_{n=1}^{\infty}A_n=A_1 \cup (A_2 \setminus A_1) \cup (A_3 \setminus (A_1 \cup A_2) ) \cup \cdots \cup (A_n \setminus (A_1 \cup \cdots A_{n-1}) \cup \cdots= A_1 \cup (A_2 \cap A^c_1) \cup (A_3 \cap (A^c_1 \cap A^c_2) ) \cup \cdots \cup (A_n \cap (A^c_1 \cap \cdots \cap A^c_{n-1})) \cup \cdots$$