I read about the Gauss law of electrostatics which is given by
$$\oint \vec E \cdot \vec da =\frac{q_{enclosed}}{\epsilon_o}$$
I was told by my teachers that the term $\vec E$ in the above equation is the total electric field due to all the charges inside as well as outside the Gaussian surface. And this is where I am confused.
I think we can rewrite the above equation (on the basis of principle of superposition) as :
$$\oint (\vec E_{inside \; charge}+{\vec E_{outside \; charge}})\cdot \vec da =\frac{q_{enclosed}}{\epsilon_o}$$
So again we can rewrite it as
$$\oint \vec E_{inside \; charge}\cdot \vec da + \oint \vec E_{outside \; charge}\cdot \vec da =\frac{q_{enclosed}}{\epsilon_o}.$$
The second term in the above equation is essentially the electric flux of charges situated outside the Gaussian surface which is equal to $0$.
So from this result, we can notice that the electric field which we get using the Gauss law is the field of the charges inside the surface only which is in contradiction with what I read in my books and also with what I was taught by my teacher.
So Where am I wrong and what actually $\vec E$ represents? Also Why is so much emphasis given on the fact that $\vec E$ in the Gauss law is total electric field and not just the field of charge inside the body? Please forgive me if I am making a silly mistake.
Edit : Since the only flux which remains in the integral is the flux of the charge inside the Gaussian surface and if the surface is symmetrical, then we can take the $\vec E$ out and calculate this $\vec E$ by finding the area after solving the integral.
I read about the derivation of electric field of an infinitely long wire by assuming a coaxial Gaussian cylinder in my NCERT book.
And since we know that the net flux in the Gaussian surface is of the inside charge this suggests that the electric field $\vec E$ we will get after solving the integral (assuming symmetry) is the field of the charge inside the wire.
But this is what NCERT says
This is very contradictory.
Please help me on this one?