wp_logout_url($redirect); is not working in wordpress

You are using PHP tag inside echo statement.

Try this:

echo '<a href="'.wp_logout_url().'" title="Logout">Logout</a>';

If you want to redirect to any specific url then you can pass it as argument of wp_logout_url.

Check official documentation of wp_logout_url.

Note :

It is recommended to return value from the shortcode function rather than directly displaying it. Try return instead of printing output by echo.