Too may redirects when i use the wp_redirect() function

This will help you want you want to achieve.

// Add option
register_activation_hook( __FILE__, 'me_shakeeb_install' );
function me_shakeeb_install() {

    $result="signup"; // Perform your logic here to decide where to redirect
    add_option( 'me_shakeeb_redirect_to', $result );
}

// Check Option
add_action( 'init', 'me_shakeeb_signup_check' );
function me_shakeeb_signup_check() {

    /**
     * Redirect to about page.
     */
    if ( false !== get_option( 'me_shakeeb_redirect_to', false ) ) {
        $page = get_option( 'me_shakeeb_redirect_to', false );
        delete_option( 'me_shakeeb_redirect_to' );
        wp_redirect( admin_url( 'admin.php?page=$page' ) );
        exit;
    }
}

tech