the aim of my exercise is to give a proof of the König's lemma. So, let $\kappa, \lambda$, be cardinals such that $cf(\kappa)\leq \lambda$. My professor's suggested us to prove that there exists a sequence $(\kappa_\alpha)_{\alpha\in \kappa}$ of cardinals such that $\kappa=\sum_{\alpha\in \lambda}\kappa_\alpha$ and $\kappa_\alpha<\kappa$ for each $\alpha < \lambda$.
Now, I've tried to prove it, but I'm not sure that what I've done is correct. I know that there exists a cofinal map $f: cf(\kappa)\rightarrow \kappa$ and, simply by definition of cofinal map, we have that $\kappa=\text{sup}\{f(\gamma):\gamma\in cf(\kappa)\}=\bigcup_{\gamma\in cf(\kappa)}f(\gamma)$. Now I set $f(\gamma)=\kappa_\gamma$ for each $\gamma\in cf(\kappa)$ and I define $\kappa_\delta=\varnothing$ for each $cf(\kappa)\leq \delta<\lambda$.
So, we have that $\kappa=\bigcup_{\alpha\in \lambda}\kappa_\alpha$ and each $\kappa_\alpha<\kappa$. But now my problems are:
1) I'm not sure that each $f(\gamma)=\kappa_\gamma$ is a cardinal, I only know that it is an ordinal;
2)Can I conclude that $\kappa=\bigcup_{\alpha\in \lambda}\kappa_\alpha=\sum_{\alpha\in \lambda}\kappa_\alpha$?
Can someone help me? Am I on the right way to solve the exercise or should I solve it in a different way?
Your approach slightly fails if $\kappa$ is not a limit cardinal. For example $\kappa=\aleph_1=\lambda$.
In that case $f(\gamma)$ are all countable ordinals, and almost none are actual cardinals, and if you "correct" $\kappa_\alpha$ to be $|f(\gamma)|$ then you get on one hand the sum is indeed $\aleph_1$, but on the other hand the union is $\omega$.
So to point out, there are two problems, the first is that indeed $\kappa_\alpha$ need not be a cardinal and the second is that indeed $\bigcup\kappa_\alpha$ need not be equal to $\sum\kappa_\alpha$. However, if you take $\kappa_\alpha=|f(\gamma)|$ (or $0$ for $\alpha$ large enough), the sum is $\kappa$, but the union might not be.
To correct this, prove the following equality:
$$\sum_{i\in I}\kappa_i = \sup\{\kappa_i\mid i\in I\}\cdot|\{i\in I\mid\kappa_i>0\}|.$$ (If $\kappa_i>0$ for all $i\in I$, then this is just $|I|$.)
Now you don't care that the union is $\kappa$ again.
Another way to prove this would be to take the intervals $\Bigl[f(\gamma),f(\gamma+1)\Bigr)$ and consider their cardinality. Then you get the benefit of a disjoint union which is obviously the sum of their cardinality as $\kappa_\gamma$ (and $0$ for sufficiently large $\alpha$ as you have done). And it is always the case that a non-cofinal subset of a cardinal has strictly smaller cardinality.