You will use command-line editors such as vim or emacs or pico to edit the file—if you want/need to use a GUI editor, use BBEdit or textedit and select plain text—and make your changes.
pico is the easiest command line editor to use of the three, as it shows the editor commands on the screen.
BBEdit is a commercial product with a useful free tier. The free tier does all you’ll need here, and more. The free tier within BBEdit replaced the free TextWrangler editor.
To edit one of the bash login scripts:
pico ~/.bash_profile
or if you’re setting up zsh:
pico ~/.zshrc
About shell scripts in Terminal on Mac - Apple Support
Use command-line text editors in Terminal on Mac - Apple Support (this lists nano, but you’ll actually get pico. For discussion and usage purposes here, pico and nano can be considered the same.)
Command Line Primer
If you’re unsure about using the shell, or about a particular shell command, then I’d tend to suggest creating and using a second separate login for experimentation and testing. While you can’t damage macOS Monterey itself, an errant shell command can potentially damage or delete your own local files. Be very careful with -R “recursive” commands for instance, on chmod and rm and ilk. Have backups, etc.