How to immediately apply values in customizer js api

Since you are invoking the change callback directly:

value.call( customize, func );

Since you’re not passing in the value, then newval will be undefined and $customStylesheet.text(newval) will do nothing.

You need to pass in the value like so:

value.call( customize, func, value.get() );

Nevertheless, it would be better to re-use the existing style element that is already output by PHP and only update it when the setting is changed, rather than create it dynamically with JS each time.

So your PHP should have something like:

add_action( 'wp_head', function() {
    $options = get_theme_mod( 'cf7md_options' );
    echo '<style id="cf7md-style">';
    if ( isset( $options['custom_css'] ) ) {
        echo strip_tags( $options['custom_css'] );
    }
    echo '</style>';
}, 101 );

And your customizer preview JS can be simply:

(function( $, api ) {
    api( 'cf7md_options[custom_css]', function( setting ) {
        setting.bind( function onChange( value ) {
            $( '#cf7md-style' ).text( value );
        } );
    } );
}( jQuery, wp.customize ));

error code: 523