\(-x\left(m-x\right)\left(x+2m\right)\left(x+m\right)+m^4\\ =x\left(x-m\right)\left(x+2m\right)\left(x+m\right)+m^4\\ =\left[x\left(x+m\right)\right]\left[\left(x+2m\right)\left(x-m\right)\right]+m^4\\ =\left(x^2+mx\right)\left(x^2+mx-2m^2\right)+m^4\\ =\left(x^2+mx\right)^2-2m^2\left(x^2+mx\right)+m^4\\ =\left(x^2+mx-m^2\right)^2\left(đpcm\right)\)