The output of the LSTM is o,(h,c)  where o is the output of size (sequence, batch, hidden), and tuple (h,c) where h is the last hidden state. You can take this h and pass it as initial hidden state to next batch.