Try

echo "Enter the source directory:"
read src_dir

echo "Enter the destination directory:"
read dest_dir

# Check if destination directory exists, if not, create it
if [ ! -d "$dest_dir" ]; then
  mkdir -p "$dest_dir"
fi

# Move all text files from source to destination
find "$src_dir" -name "*.txt" -exec mv {} "$dest_dir" \;