Below shell script on SSH mode is not working.
variable end_pos is getting value "Stop", but when it comes in IF loop , it doesn't check the condition and loop is getting failed.
Output of command :
 /mysql/mysql/bin/mysqlbinlog mysql-bin.000001 |tail -10| grep -w -A1 154 | grep -w "Stop" |awk '{print \$10}' 
is STOP
echo \$end_pos; print STOP
 #!/bin/bash
ssh -t -t username@hostname << ENDSSH
  cd /logs
echo "8. We are in SSH mode now" >./log_master.txt
end_pos=\$(/mysql/mysql/bin/mysqlbinlog mysql-bin.000001 |tail -10| grep -w -A1 154 | grep -w "Stop" |awk '{print \$10}')
echo \$end_pos;
 if  [ "\$end_pos" == "*Stop*" ];
  then
     echo "Loop succeed" >>./log_master.txt
 break
  else
      echo "loop failed" >>./log_master.txt
 fi
exit;
exit;
ENDSSH
After ilkKachu comment i put quotes in "ENDSSH" ( this is the only change i made) and executed .It threw error. Then i used second method of putting double brackets as shown below .
But when executed below script , i was getting this : if [[ "" = "Stop" ]];
  #!/bin/bash
 ssh -t -t username@hostname << ENDSSH
 cd /logs
 echo "8. We are in SSH mode now" >./log_master.txt
end_pos=\$(/mysql/mysql/bin/mysqlbinlog mysql-bin.000001 |tail -10| grep -w -A1 154 | grep -w "Stop" |awk '{print \$10}')
 echo \$end_pos;
if  [[ "$end_pos" == "*Stop*" ]];
 then
 echo "Loop succeed" >>./log_master.txt
 break
 else
  echo "loop failed" >>./log_master.txt
fi
exit;
ENDSSH

