Register visits of my pages in wordpresss

I have a shortcode that obtains the name of the person logged into wordpress, I would like that shortcode when the person enters a page where I have my shortcode create a .text file and save their name inside it

this is my wordpress shortcode

function alertaLogin( $atts ) {
    global $current_user, $user_login;
    add_filter('widget_text', 'apply_shortcodes');
    if ($user_login)
        return 'hola ' . $current_user->display_name;
        return 'no ha iniciado session';
add_shortcode( 'shortcode_login', 'alertaLogin' );

How can I create a .txt from this shortcode to store data within it ???