WordPress post pagination continuous [duplicate]

get_next_post returns null if there is no post anymore. And then get_permalink will have a null value for $next_post, so it will get the permalink for the current post, resulting in linking to the same post again and again.

You should thus check for null, and if so, link to the first (latest) post.
Something along the lines of (in your code style):

function next_shortcode( $atts ) {
    $next_post = get_next_post();
    if ( ! is_null($next_post) ) {
        return get_permalink( $next_post );
    }
    $posts = get_posts( 'numberposts=1' );
    return $posts[0];
}