Creating real analog outputs from a digital pin is possible when you use an R-2R DAC. What is a DAC? The letters stand for D igital to A nalog C onverter. This simple DAC is built using resistor. The principle works on voltage dividers. By enabling different combinations of resistors, it is possible to get various voltage levels.
Obviously, such a simple design will have some trade-offs.
The resolution depends on how many resistor steps you include. That is why discrete R-2R networks built on a breadboard have a staggered look. You could add more levels to smooth it out, or there are other options.
This R-2R Logic Noise Post talks about howย they work in detail and even includes a section on filtering the output to be less “stepped.”

