Why it doesn’t create a custom post type after form submitting

wp_enqueue_scripts action is not meant to add PHP code to your page. It is used to add JS scripts.

https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/

wp_enqueue_scripts is the proper hook to use when enqueuing scripts
and styles that are meant to appear on the front end. Despite the
name, it is used for enqueuing both scripts and styles.

If you want to handle your post submission, you can use the init or admin_init actions (if you are on the public website or the admin section). You might need to hook wp if you need to access the global $post object.

Do you get anything in your error handler? Can you check that you correctly get your posted data with var_dump($_POST);?

Does your post type channels is registered somewhere, your current user needs to be allowed to create the post type. You should check the capabilities that you set when registering your post type. https://developer.wordpress.org/reference/functions/register_post_type/

error code: 523