read all data based on length of output