Every time I press enter in the terminal it says Karans-MacBook-Air:~ karanmunjal$. How do I fix this?
Right now, it is showing you the default prompt, which is your computer name, current directory and the username.
export PS1="$"
or export PS1="\w $"
or similar (see https://ss64.com/bash/syntax-prompt.html)
should relieve you. If you're convinced, append your custom command to ~/.bash_profile
and reopen Terminal.
Other than that, pressing enter is actually running an empty command, so after completion, the prompt returns to receive further ones. That is expected behaviour.
Just in case, you want to edit computer name, Go to System Preferences -> Sharing and edit it under Computer Name.