adds save output option to histogram function