When I want to edit the question/answer, or another user did, SO store the previous sentence that was deleted or modified, and will compare it with the new sentence or word. Did SO store all that edited/modified question/answer post into database? Even when I am trying to edit the question and answer many times (ex. 20 times). Does SO store all of that previous work into Database?
SO store the previous sentence that was deleted or modified
Not exactly. The entire text of older revisions is stored. When you view revisions, the modified text is highlighted (and non-modified may be truncated), but that is something that is done at the time of rendering, by an algorithm that highlights differences between two versions of a text.
Even when I am trying to edit the question and answer many times (ex. 20 times).
When you make consecutive edits within 5 minutes, they will generally* be stored as one, that is, the later revision will replace the earlier one in the database. So, 20 edits in 5 minutes will not create 20 revisions.
(*) exception: if someone added a comment or an answer to a post, that particular revision (to which comment/answer was posted) will not be replaced by later edits, even if they happen shortly afterwards.