an action or event that started in the past and continued up to another point in the past. It is used for expressing the duration.
e.g. Mike had been trying to install the new program on my computer for two hours, when he suddenly found the error.
They had been playing qietly for two hours when they suddenly started to shout at each other.