You can perform batch training using:
You can also write a generator that yields batches of training data and use the method model.fit_generator(data_generator, samples_per_epoch, nb_epoch).
If you want to iterate your dataset, you should probably use model.train_on_batch and take care of the batch sizes and iteration yourself.
You should also make sure that the order in which the samples you train your model is shuffled after each epoch. The way you have written the example code seems to not shuffle the dataset.
Hope this answer helps.