Suppose I have an equation $x^2+kx+k$ and the required condition for its roots is $D=0$. After splitting the middle term we obtain $k(k-4)=0$. By the rules, the factors are $k=0,4$ but what if I transposed the '$k$' towards $0$ making the equation $k-4= \left(\frac{0}{k}\right) \implies k-4=0$, thus $k=0$.
Why can't this be the correct answer as $4$ will be the two equal roots.
With "transposing the $k$" I assume you're trying to solve this equation by dividing both sides by $k$. But remember that you cannot divide by $0$, so this step is only valid if $k \ne 0$. You can check this case separately and notice that $k=0$ indeed satisfies the original equation so it is a solution too.
Here I think you mean "thus $k=\color{blue}{4}$"? You "lost" the solution $k=0$ but you still get $k=4$.