Add new line after 'continue' in if statment

Hello,

im creating a csv file for email reporting on issues.
my problem is that after 'continue' command in if statment in a loop
the new paramter writing into the log doesnt take new line.

timeout 4s zabbix_get -I $ZBX -p $PORT -s $IP -k "system.run[grep "wheel" /etc/group]"

                if [ $? -eq 124 ]; then
                        echo -e "$RED TIMEOUT $NC"
                        sed -i "/$IP/s/$/ ,TIMEOUT/"  $LOG
                        continue
                fi

so if a good log that does not get TIMEOUT looks like that :

IP,Wheel user,Note
192.168.1.1,root someuser1 someuser2
192.168.1.2,root someuser1 someuser2

if some ip gets timeout and gets to the 'continue' the log is written like that :

IP,Wheel user,Note
192.168.1.1,root someuser1 someuser2192.168.1.2, ,TIMEOUT

i need to make the new writen line in the log file as a new line
or tell the sed command somthing.

to make it look like that :

192.168.1.1,root someuser1 someuser2
192.168.1.2, ,TIMEOUT

i tried to look for an answer but couldnt find.
and i cant just add new line as it make an empty line in csv.

thanks

Is that reproducible or a sporadic behaviour?
Is that $LOG file being written to elsewhere?

What is that continue for?

Hey,
LOG is simply a file /tmp/zabbix.csv that after the script i can atteched to email

continue acts like that -
if there is a time out on some IP it does no continue all the loop with this ip
and continue to next ip .

echo  "IP,Wheel users,Notes" | sudo tee -a $LOG

for IP in $HOST
	do
		echo -n "$IP, "  | sudo tee -a $LOG
		timeout 4s zabbix_get -I $ZBX -p $PORT -s $IP -k "system.run[grep "wheel" /etc/group]" 
		if [ $? -eq 124 ]; then
			echo -e "$RED TIMEOUT $NC" 
			sed -i "/$IP/s/$/ ,TIMEOUT/"  $LOG
			continue
		fi

as this script has more commands after that block
but if i get timeout there is no need for me to do all the loop with this ip
as ill get timeout 5 times. so its continueing to the next ip in the file $HOST

Much clearer now.

Your echo -n suppresses the line terminator (to be added by the zabbix_get later), and the sed script doesn't add it either. Try adding a \n after the "TIMEOUT" string in your sed command.