Add code to a specific post’s content

Your code is fine, but your logic isn’t working because of $cat. $cat is returning an Array with an Object which you’re trying to check against. But you can easily just use in_category(‘music’) like this:

function add_go_back_btn($content) {
 global $post;
 $cat = get_the_category();
 $post_type = get_post_type();

 if(in_category('music') && $post_type === 'post') {
    return '<div><a href="https://wordpress.stackexchange.com/music">This is a button</a></div>' . $content;
 } else return $content;
}
add_filter( 'the_content', 'add_go_back_btn' );