This is on macOS, right?
As it's difficult to edit the file from a terminal (owing to the fact that the shell will immediately exit), open the file you previously modified (probably
~/.profile), from the Finder, in a text editor, and correct the error.
You should be able to toggle the listing of hidden files in any "Open File" dialog box, or in the Finder itself, by pressing ⌘ CMD+⇧ SHIFT+..
Another option is simply to rename the file that you think is causing the issue. Again, do this from the Finder.
Speculating on the cause:
You may have inadvertently executed
exit, possibly unconditionally, or through following some logic branching. Or you may have used
set -e or
set -o errexit and then had a utility exit with a non-zero exit status (i.e. failing).