Proper output functionwhen script is done