Save Post Permalink In .txt File

I haven’t got enough points to comment a link and I don’t wish to plagiarise the answer from another website, but I hope this helps

add_action( 'publish_post', 'update_txt_file' );
add_action( 'publish_page', 'update_txt_file' );

Reference: https://wpza.net/wordpress-setup/how-to-update-a-file-after-new-post-or-page-in-wordpress/

tech