add the changeLogic function and put data output into the text file