Bash loop to search file

In the bash when the user inputs an id to search for the bash currently closes, and if a match is found outputs a new file (match.txt). Is it possible to have not close the bash but rather, on the screen "searching for match" and if a match is found "match found in line.." is displayed and written to match.txt else "no match found" is displayed on the screen and no file is written. Thank you :).

The code below downloads a getCSV file then the user enters an id and that input is used to search the getCSV file. Currently, the last part is not working. I have added a loop and modified so other parts of the code with no luck.

#!/bin/bash

printf "establishing connection and downloading file, please wait"
cd 'C:\Users\cmccabe\Desktop\wget'
curl -# -o getCSV.txt http://xxx.xx.xxx.xxx/data/getCSV.csv
   
	   
 printf "Download complete, what is the id of the NGS patient: "; read id
	[ -z "$id" ] && printf "\n No ID supplied. Leaving match function." && sleep 2 && exit 1
  	
printf "searching, please wait" 
result=`grep -n "${id}" getCSV.txt`
while read -r line
 do
if [ -n "$result" ]; then
   echo "match found in line $result" >> match.txt
else
  echo "no match found"
 done
fi 

get rid of everything from while read -r line down and try something simple like :

if  grep $id getCSV.txt
then
   echo "match found in line $result" | tee -a  match.txt
else
  echo "no match found"
fi

@cmccabe, Any specific reason to create a new thread ? If its similar problem, please continue here

You have received some of the nice replies and I guess few questions have been asked to you.
Creating new thread will lead to revisit the same problem and wasting of everyone's time.
Thanks.

Moderator comments were removed during original forum migration.