Unable to understand char-lstm example in MXNET for Julia

I am trying to understand the char lstm example mentioned here - https://github.com/dmlc/MXNet.jl/blob/master/examples/char-lstm/lstm.jl

Function lstm_cell accepts the second parameter as previous state -
function lstm_cell(data::mx.SymbolicNode, prev_state::LSTMState, param::LSTMParam;num_hidden::Int=512, dropout::Real=0, name::Symbol=gensym())
However, in the section - #stack LSTM cells

next_state = lstm_cell(hidden, l_state, l_param, num_hidden=dim_hidden, dropout=dp,name=Symbol(name, “lstm$t”))
hidden = next_state.h
layer_param_states[i] = (l_param, next_state)

layer_param_states[i] gets updated with the next state- layer_param_states[i] = (l_param, next_state)
why is this done here. Why is the previous state being updated with the next state.