I didn't quite understand what do you mean with 'i want to show the error in script'. If you want to print an informative error message to stderr than the following may help
TRG_DIR="/home/xyz/temp/logs"
if test -d "$TRG_DIR"; then
cd "$TRG_DIR"
else
echo "$TRG_DIR does not exist" >&2
exit 1
fi