Deleting some unnecesary output..
and simplified an if condition..
it's supposed to check at the end of each simulation whether the current stock is less then the allowed max stock or not.
if it is, order item till it reach max stock.