Reduce undecidable language to decidable language? What happens if I build the following mapping function from $A_{\mathrm{TM}}$ to $A_{\mathrm{LBA}}$ (LBA means linear TM with a limited tape space and $A_{\mathrm{LBA}}$ is decidable):

If $M$ accepts $w$ then returns an LBA which decides the language {'111'}.

Clearly if $(M,w)$ is in $A_{\mathrm{TM}}$ then $f(M,w)$ is in $A_{\mathrm{LBA}}$ but then $A_{\mathrm{TM}}$ would be decidable!

What am I missing here?
... but then $A_{\mathrm{TM}}$ would be decidable!


No. Because your $f$ is not computable since one cannot compute whether $M$ accepts $w$, as Yuval Filmus said in the comment.