The IBM Selectric is a magnificent piece of engineering, and close to being the last complex piece of mass-manufactured mechanical logic . The only electrical part is a motor.
But it's not the ancestor of the computer printer.
The Selectric's main ancestor is the Blickensderfer_typewriter [1], from 1892. This used a curved type element rather than a typeball, but had a similar method of turning key presses into typing element positions. As with the Selectric, the font could easily be changed. There was a proportional-spacing successor to the Blickensderfer, the Vari-Typer, and IBM imitated that, too, with the IBM Selectric Composer.
The Selectric had a moving print head rather than moving paper, with cables on moving idlers used to transmit position to the print head. That mechanism is from the Teletype Model 28/35, from the early 1950s. Moving the print head rather than the paper was a Teletype concept - it worked much better with roll paper, and the machine was narrower.
The Selectric mechanism was not designed for electrical inputs and outputs. The add-on mechanism for that was an afterthought, and kind of a hack. The unit had to be built into a table, and the mechanism for the keyboard extended below the tabletop. IBM and Remington had previously built typewriters with electrical I/O, and those were used with some early mainframe computers.
Many computers, before and after the Selectric, used Teletype machines as I/O devices. That lasted until daisy-wheel printers and cheap CRT terminals were invented.
(Mechanical line printers have a completely separate history. They descend from the Potter Flying Typewriter.[2])
[1] https://en.wikipedia.org/wiki/Blickensderfer_typewriter
[2] https://www.computer.org/csdl/proceedings/afips/1952/5041/00...