For a function $f(x)$ determined and continuous with $\forall x\in $ $\Bbb R\setminus\left\{ 0 \right\}$ such that
$$x^{2}f^{2}(x)+(2x-1)f(x)=xf'(x)-1$$ and $f(1)=-2$
Find $$\int_{1}^{2} f(x)dx $$
I write: $$(xf(x)+1)^{2}=(xf(x)+1)'$$
But I do not know how to proceed
Following from the comments, you can rewrite $g(x) = xf(x)+1$. Then
$$ g(1) = 1\cdot f(1) + 1 = -1 $$
The equation becomes
$$ \frac{g'(x)}{(g(x))^2} = 1 $$
Then $$ \left[-\frac{1}{g(x)}\right]' = 1 $$
Integrating both sides
$$ -\frac{1}{g(x)} = x + C $$
Using the initial condition as above, we have $$ -\frac{1}{g(1)} = 1 + C \implies 1 + C = 1 \implies C = 0 $$
Solving for $g(x)$
$$ g(x) = -\frac{1}{x} $$
Solving for $f(x)$
$$ f(x) = \frac{g(x)-1}{x} = -\frac{1}{x^2} - \frac{1}{x} $$
You can now do the integration