Previous acquisitions were important in the generic drugmaker’s third-quarter success as it looks to buy again.