TL;DR Your results are off by a factor 2 because you are using an instantaneous force, i.e. the force spring exerts at some displacementat some displacement. If you had used an average spring force between 0 and that displacementbetween 0 and that displacement, you would have got the correct result.
See below for detailed explanation where does the difference come from.
Numerical evaluation
The problem with your procedure is that you calculated work as as $2.0 \text{ N} \cdot (-0.20 \text{ m}) = -0.40 \text{ J}$, as if the spring force $2.0 \text{ N}$ was constant over whole displacement $-0.20 \text{ m}$, which obviously is not true. To calculate work in this way, you must use the average force spring exerts over the displacement! The average force is calculated to be $1 \text{ N}$ in limit case as $\Delta x$ approaches zero, and the total work is $1 \text{ N} \cdot (-0.20 \text{ m}) = -0.20 \text{ J}$.
Work done by spring
where $k$ is the spring constant and $x$ is the elongation. The minus sign defines that the spring (force) always acts in the direction opposite to the elongationforce exerted by the spring always acts in the direction opposite to the elongation.
where $U_e = \frac{1}{2} k x^2$ is the elastic potential energy, and $\Delta$ denotes a difference (final minus initial value). If you are not familiar with calculus and integrals ($\int$ and $dx$ in the above equation), what it means is that you sum the spring force ($-kx$) for every elongation $\{x,x+dx,x+2dx,...\}$ between $x_1$ and $x_2$, where $dx$ is infinitesimally small increment, just as we did in the numerical evaluation above.
$$W_e = \bar{F_e} \cdot (x_2 - x_1) \quad \text{or} \quad \boxed{\bar{F}_e = -\frac{1}{2} k (x_1 + x_2)} \tag 3$$$$W_e = \bar{F_e} \cdot (x_2 - x_1) \qquad \text{or} \qquad \boxed{\bar{F}_e = -\frac{1}{2} k (x_1 + x_2)} \tag 3$$
Back to your example...
The Eq. (3) explains why your results are off by a factor 2. If you take that the spring starts from the relaxed state ($x_1 = 0$), then the average force between $0$ and $x_2$ $0$ and $x_2$ and instantaneous force atexactly at position $x_2$ $x_2$ are
$$\bar{F}_e = -\frac{1}{2} k x_2 \quad \text{and} \quad F_e = -k x_2$$$$\bar{F}_e = -\frac{1}{2} k x_2 \qquad \text{and} \qquad F_{e,2} = -k x_2$$
In this particular case you can calculate the work done by a spring asis $W_e = \bar{F}_e x_2 = -\frac{1}{2} k x_2^2$$W_e = \bar{F}_e (x_2-0) = -\frac{1}{2} k x_2^2$, but not as $W'_e = F_e x_2 = -k x_2^2$$W'_e = F_{e,2} (x_2-0) = -k x_2^2$! In your exampleNotice that $W_e' = 2W_e$, which explains the factor 2 mismatch in your calculations. The force $2 \text{ N}$ in your example corresponds to the instantaneous force at $-0.2 \text{ m}$ and not to the average force between $0 \text{ m}$ and $-0.2 \text{ m}$.