Calculation of Output in LSTM Many-to-One Architecture
While training, a set of training examples will be provided in a batch. At end of each batch, weights for all layers are updated (Dense and LSTM). 

https://adventuresinmachinelearning.com/keras-lstm-tutorial/