Yesterday we wrote a test. I was late for the classes. When I entered the classroom, the students of our group were writing the test. They had been writing it for a half an hour. Some of them had already finished the test and had given it to the teacher.
had been working
We had seen the play before we discussed it.
We saw the play and then discussed it.
I was in London last year. I had not been there before.
He did not like the letter, which he had been trying to write for two hours.
When we came, he had already returned and was writing something in his study.
He had finished his work and was sitting on the terrace.