Added lines to read and write training data

Are we doing it right?