In ArcPro 2.6 and 2.7 (may be also in earlier versions?) if you enter any lines of code in the Python command line window a copy of what you entered is stored in a file called .pyHistory which is in the same folder as the aprx file.
How does one stop the creation of this file, or clear it from within ArcPro? Right clicking on any entered code offers up Clear Transcript, this clears the window only and not the contents of .pyHistory .