While the Sun and Earth attract each other, they cannot fall into each other because of **angular momentum conservation**. In a central field (where the force is acts in the direction of the distance vector and depends on distance only), the specific angular momentum vector $\boldsymbol{L}=\boldsymbol{r}\times\boldsymbol{v}$ is conserved ($\boldsymbol{r}$ is position and $\boldsymbol{v}$ the velocity). In particular $L=|\boldsymbol{L}|=rv_t$ (with $v_t$ the tangential velocity: the component of velocity perpendicular to the direction Earth-Sun). The specific orbital energy $E=\tfrac{1}{2}\boldsymbol{v}-GM/r$ is also conserved and must be negative for a bound orbit (such as Earth's). Combining these two we have
$$
E = \tfrac{1}{2}v_r^2 + \frac{L^2}{2r^2} - \frac{GM}{r}
$$
with $v_r$ the radial component of velocity. Since $v_r^2\ge0$, but $E<0$, not all radii are reachable. In particular there are two radii at which $v_r=0$: the apo- and peri-apse of the orbit.

In fact, for the Earth, the peri- and apo- apse are quite similar, and the orbit is nearly circular. The gravitational pull of the Sun is very nearly balanced by the centrifugal force due to the rotating orbit.

-------------