Create Cronjob for wordpress plugin

Good Day, I have created a plugin to import products to woocommerce, what I want to do now is create a cronjob for it. but all that I have tried does not work. This is the code I used.

function empty_product_table_function() {
$table_name='products';
$truncatetable=$wpdb->query($wpdb->prepare("TRUNCATE TABLE $table_name"));
wp_mail( '[email protected]', 'Shop Cron', 'The Cron started' );
}
if($truncatetable !== FALSE)
{
   echo("All rows have been deleted.");
}
else
{
   echo("No rows have been deleted.");
}

from there I created a cron in wp control but still noting i used this totorial to create it
Cloudways

can someone point me in the right direction