The loss for a mini-batch is the average loss per sample. You seem to be trying to calculate the average loss per sample over all the samples.
Keras on the other hand calculates the average loss per mini-batch, which is the average loss per sample over the mini-batch.
Mathematically, assuming that the batch size is constant, the two calculations are equivalent. The batch size is constant because it is a parameter of model.fit().
It is however possible that neither calculation gives you what you want. If you have 105 samples and a batch size of 20, then you can either make 5 batches of 20 samples discarding the other 5 samples, or you could make 6 batches of 20 samples thus repeating 15 samples. I assume that keras does the first of these. Either way, collecting the losses reported at the end of each minibatch as you do will not give you exactly one loss per sample in your dataset. In practice the loss given by keras is usually pretty close to the true value, and I assume the division of the dataset into batches is done the same way at each epoch, which means that you can meaningfully compare the loss calculated by keras from one epoch to the next.
You could run a prediction across the whole dataset and then calculate the loss by hand, but in practice, unless your batch size is too large for your training set, the epoch loss reported by keras will be pretty close to the true figure.
There are probably more important problems to worry about.