It can be done with the form configuration. There is a setting in the form properties that says that any edits to a document should spawn a copy. the copy can then become the parent with all previous versions appearing as child documents.
See this topic in Help:
Version tracking allows you to maintain a history of changes to a document. In order to activate version tracking, you must designate the form used to create documents as a version-tracking form.
If you want more control than the form configuration, then you want to look at the Domino Designer help for these topics: