multiple record insert creating many duplicate records

For running in WP cron, you’ll define your function, and then hook the function to the cron’s name.

Example:

function cron_function() {
    ...
}

add_action( 'cron_hook', 'cron_function' );

if ( ! wp_next_scheduled( 'cron_hook' ) ) {
    wp_schedule_event( time(), 'one_minute', 'cron_hook' );
}

See WordPress developer resource for more info:
https://developer.wordpress.org/plugins/cron/scheduling-wp-cron-events/