from digital to analog, then back to digital?
It didn't go "back" to digital.
Although the EGA and the HDMI signal are both "digital" and the VGA signal is "analogue", the (digital) EGA signal is quite similar to the (analogue) VGA signal but it is completely different from the (digital) HDMI signal:
Both in a VGA and in an EGA signal the voltages of electrical signals directly reflect the color which is displayed at the position where the three electron beams of a CTR tube monitor currently point to.
EGA uses 6 digital signals for the color, two for each electron beam
This means that 2^6 = 64 different colors are possible
CGA uses 4 digital signals for the color
This means that 2^4 = 16 different colors are possible
- VGA uses 3 analogue signals, one for each electron beam
HDMI uses 4 digital signals. If HDMI worked like EGA, 16 colors would be possible using 4 digital signals.
However, HDMI works completely differently:
The voltages of the four signals measured at a certain time do not directly reflect the color of a certain pixel.
Instead, the HDMI signal is more comparable to an Ethernet signal while you are streaming a video over the network: Data bits of a video file are transferred over the HDMI wire and some electronics in the monitor will perform the video file decoding.
The analogue "composite video" signal (for TV sets) works differently than all of the signal types I described above.
Why did computer video outputs go from digital to analog
In the 1980s, both analogue and "EGA-like" digital signals were used.
However, around 1990 higher color resolutions became standard. For 256 colors we would require 8 wires in a "EGA-like" digital signal; and for 16M colors we would require 24 wires. And of course we would need to change the monitor because a "256-color monitor" has only 8 input wires...
A VGA signal requires only 3 wires; and because a VGA monitor has an analogue input, it is theoretically able to display any color depth, so we don't have to change the monitor when changing from 256 to 16M colors.
... then ... to digital?
With higher resolutions "VGA-like" signals will have problems. Just one example: The frequencies of the signals rise and you will have signal crosstalk between the wires.
Using an "Ethernet-like" signal (such as HDMI) was the solution for these problems.
In the early 1990s such a technology would have been very expensive (unless it should only support a very low video resultion). For this reason nobody was thinking about such a technology.