I tried to short this expression: $$\frac{x^2-y^2}{x(x-y)}+\frac{x^2-y^2}{x(x+y)}$$
The result should be $2$ but I get: \begin{align} &\frac{x^2-y^2}{x^2-xy}+\frac{x^2-y^2}{x^2+xy}\\ =& \frac{y^2}{yx}+\frac{-y^2}{yx}\\ =&0 \end{align}
What did I do wrong?
You did not find a common denominator before adding the fractions since $x^2-xy\neq x^2+xy$. Moreover, you cannot add fractions 'top to bottom', that is $$ \frac{2}{3}+\frac{1}{4} \neq \frac{3}{7} $$ this is why we find the common denominator. Try finding the common denominator first, it will be ....
and then adding your fractions.