How is the magnitude of force exerted by the external agent equal to the electrostatic force when talking about electric potential energy? I was watching a video about Electrostatic Potential and Electric Potential Energy by Professor Walter Lewin when I encountered a question.

So, Professor Lewin assumes that a charge $Q$ was placed in free space, and hence, no work was done to place it there. Then, another charge (a test charge) $q$ was placed at a distance of $R$ from $Q$. Now, some work would have to be done by the external agent placing $q$ near $Q$.

We say that the charge was brought from a distance of $\infty$ from $Q$ to a distance of $R$ from it.

The work that would be done by the external agent to do so would be equal to the potential energy possessed by $q$ at a distance of $R$ from $Q$.

So, we just need to evaluate the work done in doing so.
Professor Walter Lewin uses the formula for calculating work, specifically :
$$W = \int_a^b \vec{F \text{ }} . \vec{dr}$$
Here, $a = \infty$ and  $b = R$. Also, $\vec{F}$ is the force exerted by the external agent. Let that force be $\vec{F_2}$ in the direction opposite to that of $Fe3$ Professor Walter Lewin proceeds as follows :
$$\int_\infty^R \vec{F_2} . \vec{dr}$$
Now, he states that $\color{red}{\text{the force exerted by the external agent is equal in magnitude but opposite in direction to the electrostatic force}}$, that is $F_e$. So, $\vec{F_2} = -\vec{F_e}$.
He proceeds as follows :
$$\int_\infty^R \vec{F_2}.\vec{dr} = \int_R^\infty \vec{F_e}.\vec{dr} = \int_R^\infty \dfrac{Qq}{4\pi\varepsilon_0}.\vec{dr}$$
He simplifies the integral obtained above as $\dfrac{Qq}{4\pi\varepsilon_0R}$
Now, I was confused by the statement that I have highlighted in $\color{red}{Red}$
If the forces acting on the charge $q$ are equal in magnitude but opposite in direction at all points from $R$ to $\infty$, doesn't that cancel them out? Doesn't that mean that there will be no displacement at all and hence, no work done.

What I understood the force $\vec{F_2}$ prior to watching this video was as a force which increases as the distance between $Q$ and $q$ approaches $R$ so as to always be greater than $\vec{F_e}$ at every point by a constant amount. But that confused me, hence, I came to Professor Walter Lewin's video.
I would appreciate it if someone can clarify the relationship between $\vec{F_e}$ and $\vec{F_2}$ for me and help me to get rid of my misconceptions.

Thanks!
 A: Yes that's how I have been taught about it.
But what it actually refers to is that the object is not allowed to accelerate and hence not allowed to gain velocity during its movement.
This is because in the case that it's allowed to gain velocity, it has a significant kinetic energy. Which should also be factored in. You could also proceed this way though it is unorthodox
The only way to avoid factoring in the kinetic energy is by making it move such that it doesn't gain velocity.
So if a force $F$ (electrostatic) exists, then external force should be $F+dF$ in the opposite direction.
This $dF$ force allows it to move slightly, but
$$dW = (F+dF). dx = (F. dx) + (dF. dx)$$
The $dF. dx$ term is so small that it is negligible (As done in several instances in calculus)
So you get the answer mentioned in the video.
A: Work Energy theorem tells us work done by all forces is equal to change in kinetic energy of the particle.
Now we bring the particle so slowly((without accelerating)) that there is no change in kinetic energy of the particle i.e $\text{change in kinetic energy of the particle} = 0$
Hence, $\text{work done by electrostatic force} + \text{work done by external force} = 0$
or
$|\text{work done by electrostatic force}| = |\text{ work done by external force}|$. Now, since displacement is same we can say that those forces are equal but opposite in direction.
