Add pyenv init to your shell to enable shims and autocompletion. Please make sure eval "$(pyenv init -)" is placed toward the end of the shell configuration file since it manipulates PATH during the initialization.
(source)
The command is designed to manipulate the environment of the shell; and to define some functions. If it's in a script then it will manipulate the environment of (and define functions in) the shell interpreting the script.
If your script is shell.sh and you run it with ./shell.sh (or bash shell.sh) then the shell interpreting the script is not your current shell. Please see What is the difference between sourcing (. or source) and executing a file in bash?
So don't expect your script to change anything in your current shell, unless you source the script:
. ./shell.sh
Note in this case the file does not need to be executable. The shebang (if any) doesn't matter.