In System Preferences > Dock, check "Minimize windows into application icon". Note that this doesn't affect any existing minimized windows, but it will affect windows you minimize from that point forward.
You can use any of several mechanisms to restore the windows:
- the Dock menu
- the application's Window menu
- application Exposé / “Application windows” in Mission Control, which you can also trigger from the Command-Tab application switcher with the up/down arrow keys
or any of several third-party apps/tools that help you with window management (e.g. Witch).
To not show them at all, just hide TextEdit entirely; you can do this with Command-H or by Option-clicking on another application's window (this includes the Desktop, which is technically a Finder window).
You might also consider using a text editor that supports placing documents in tabs, or something equivalent; while I'm a big fan of traditional Mac style window management, once you get up to 20 windows in an app, you're really in trouble :-)