The atmospheric layer that produces the absorption lines acts somewhat like a mirror at these frequencies and scatters the light back into the sun (although this is diffuse reflection not specular reflection like an actual mirror). In principle, light is scattered also outwards (with a probability of 1/2 for each scattering event), but since the layer is very dense at the line frequencies it takes many scattering events to get trough. After two scattering events it would only be a fraction 1/2 *1/2 =1/4, after three 1/2 *1/2 *1/2 =1/8 and so on (this is just to demonstrate the principle, in reality it is bit more complicated due to multiple scattering back and forth in the layer). There are so many scattering events required that very little is getting through. It is being all scattered back into the lower layers of the atmosphere where it is eventually converted to photons of different frequencies.
It is a bit similar to why you have little light from the sun here on our earth under a dense cloud layer compared to a clear sky. If you have ever been in an airplane 5 miles high above the clouds, you realize that this light missing under the clouds is in fact reflected back from the top into space, making the clouds appear blindingly white. It is just the reverse situation in the solar atmosphere (if you could take a spectrum from below the layer responsible for the Fraunhofer lines looking upwards, you would see those lines all in emission)
The following diagram (taken from https://courses.lumenlearning.com/astronomy/chapter/formation-of-spectral-lines/ ) illustrates what happens here
The specific difference is here only that the geometry of the scattering layer is different, being more like an infinitely extended vertical plane layer than kind of cylindrical. So in this case you can see the emission line (bright line) spectrum only from underneath the solar layer producing absorption lines when looking upwards (this is the emission the OP was missing in the absorption spectrum). In all other directions, you see (for obvious geometrical reasons) always the continuum source behind (which you have to assume as an extended plane layer as well) and thus the absorption spectrum.
Note that the accepted answer above is incorrect. It claims to describe the scattering of radiation, but the quoted equation effectively neglects the scattering source term when associating the source term later on with the thermal black-body term in order to bring in the temperature argument here. The correct equation is (see http://irina.eas.gatech.edu/EAS8803_Fall2017/petty_11.pdf )
Note that $\beta_e$ is here the combined absorption/scattering coefficient going into the loss term (with the minus sign), and $\tilde\omega=\beta_s/\beta_e=\beta_s/(\beta_a+\beta_s)$ is the relative contribution of scattering to the absorption coefficient. This means for pure scattering we have $\tilde\omega=1$ and the thermal black-body radiation term vanishes. The temperature argument given in the accepted answer above is therefore not applicable in this case. It is clear from this that the thermal emission is only related to the continuum absorption, which however a) is negligible in the visible region above the photosphere and b) can not produce absorption lines anyway, whether there is temperature gradient or not.
So absorption lines can only be produced by resonance scattering, as already qualitatively explained by the colour illustration above. I have made in this respect some explicit numerical calculation with my own radiative transfer program reproduced at https://www.plasmaphysics.org.uk/programs/plantrans.htm , modified somewhat to show the actual line profile rather than frequency integrated intensities.
This is what you get from a mono-directional continuum source falling from one side onto an isothermal purely scattering plane-parallel layer with a line center optical depth $\tau$=10 (assuming a Doppler (Gausian) scattering emissivity) for the transmitted line at the other end (looking vertically into the layer and including the continuum source)
and this is what is being vertically reflected back to the continuum source
Here is the same for an optical depth $\tau$=100 instead
If one looks at the actual numerical scale of the graphs, it is obvious that the amount reflected back does not fully explain the amount missing from the continuum on the other side. This is simply due to the fact these plots hold for a fixed (vertical) viewing direction only and are furthermore normalized to a solid angle of 1 steradian (which is only 1/2/$\pi$ of the full half-space the radiation is scattered back into). If one would add up the back-scattered radiation over the complete half-space, taking also into account that the line shape and intensity varies with the viewing direction, it would exactly account for the radiation that is missing in the transmitted spectrum. The question the OP had can only be answered in this way.