Site icon Hip-Hop Website Design and Development

404 error rewrite permalinks

I have a issue with my rewrite url and I hope somebody can help me out.

add_action('init', 'my_custom_rewrite'); 
function my_custom_rewrite() {

    add_permastruct('catalog', '/%customname%/', true);
    global $wp_rewrite;
    $wp_rewrite->add_rewrite_tag("%customname%", '([^/]+)', "catalog=");
}

add_filter( 'post_type_link', 'my_custom_permalinks', 10, 2 );
function my_custom_permalinks( $permalink, $post ) {
      return str_replace( '%customname%/', $post->post_name.'/'.$post->ID, $permalink );
}

After this I go to settings->permalinks and push save to flush but I get an 404 error and my url has 2 times the ID like domain.com/post-name/postID/postID

Who can help me out with this?