How to add a piece of code in function

if( in_array( 'comments',$meta_info ) ){
            $key="link";
            echo '<span class="post-meta-info with-cmt">' . apply_filters('yt_icon_comment', '<i class="fa fa-comments"></i>') . ' ';
                comments_popup_link( __( '0 Comments', 'theme' ), __( '1 Comment', 'theme' ), __( '% Comments', 'theme' ));
            echo '</span>';
            echo '&nbsp;<a href="'. get_post_meta($post->ID, $key, true) .'" target="_blank">Images Source</a>' . "\n";
        }

Try this code once. I modified the code with your supplied content.