how i can add title to my featured image?

I’m not sure about your question, but the below code is more correct.

$attr = array(
    'title' => get_the_title(),
    'alt'   => 'a nice view of the ocean',
);

echo sprintf( '<a href="https://wordpress.stackexchange.com/questions/281220/%s">%s</a>', get_the_permalink(), get_the_post_thumbnail( null, 'post-thumbnail', $attr ) );