Only the first is a possible English sentence. There are three events described here: ‘typing for three hours’, ‘typed the wrong documents’ and ‘he realised’. The first two happened at roughly the same time, and are therefore written with a past perfect construction. The first uses ‘had been’ + the –ing form of ‘type’ to show progressive aspect, because the typing is seen as continuing over a period of time. The second uses ‘had’ + the past participle of ‘type’ to show perfective aspect, because typing the wrong documents is seen as a complete event. The third event is expressed in the past tense, ‘he realised’, because it is seen as a complete event that occurred at a specific time in the past, but after the other two events.
In the second sentence, ‘he typed the wrong documents’ doesn’t work because the use of the past tense there places the event in the same time frame as ‘he realized’, which clearly happened after the typing, not at the same time as the typing.
The third sentence is almost possible, but there the past tense, ‘typed’, also gets the timing wrong. Typing the wrong documents happened before the realization of what had happened, and so needs a construction that expresses that prior occurrence. What is called for, therefore, is ‘he had typed the wrong documents.’