I fixed the issue by adding the directory to the path
First, run export FLYCTL_INSTALL="/home/mubashir/.fly"
and then export PATH="$FLYCTL_INSTALL/bin:$PATH"
in the terminal to fix the issue
You can check the changed path by echo $PATH
Helpful article: https://linuxize.com/post/how-to-add-directory-to-path-in-linux/
Edit:
The above solution will fix the error for that particular session but in order to make the path persist between session read my solution here: flyctl: command not found - #4 by mubashir