Let R be a prime ring with char \((R)\ne 2\) , I be a nonzero ideal of R, \(f(x_1,\ldots ,x_n)\) be a noncentral multilinear polynomial over extended centroid C and \(0\ne b'\in R\) . Denote \(f(I)=\{f(t_1,\ldots ,t_n) | t_1,\ldots ,t_n\in I\}\) . Suppose that F, G and H are three generalized derivations on R such that \(\begin{aligned} b'\Big \{F\Big (G(V)V\Big )-H(V^2)\Big \}=0 \end{aligned}\) for all \(V\in f(I)\) . Then the structure of the maps F, G, H are described. This result naturally generalizes the results obtained by Carini and De Filippis in [Siberian Math. J. 53 (6) (2012), 1051-1060], Dhara and Argac in [Commun. Math. Stat. 4 (2016), 39-54] and completes the incomplete result of Tiwari in [Rend. Circ. Mat. Palermo, II. Ser 71 (2022), 207-223]. At the end of this paper an example is given to show that the primeness condition is not superfluous.