update history file after every command