How to display a function inside shortcode tags

I have modified the code…

function myFunction()
{
    $output="";

    $entries = get_post_meta(get_the_ID(), '_kad_repeat_group', true);
    
    if (is_countable($entries) && count($entries) > 0) :
        
        foreach ((array) $entries as $key => $entry) {
            
            $title = isset( $entry['_kad_title_ekstra'] ) ? esc_attr($entry['_kad_title_ekstra']) : '';
            $output .= '<h4>'.$title.'</h4>';
            
        }
        
    endif;

    return $output;
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)