reading file from main using getNextData