Here I'll demonstrate the use of both 64 bit and 32 bit in one source.  After selecting the either 64 bit or 32 bit debug/release mode, you will be able to create one source file for the two architectures (you can do the same for other cpus too).

First modify your build.gradle file

change productFlavors (around line 30) from

productFlavors {
x86_64 {
ndk {
abiFilter "x86_64"
}
}
}

to

productFlavors {
x86 {
ndk {
abiFilter "x86"
}
}
x86_64 {
ndk {
abiFilter "x86_64"
}
}
}

Second modify test-nasm.asm to

; name: test-nasm.asm 32 bit and 64 bit versions
;
; description: pass a pointer to "Hello from NASM" to the calling C++ program
;
; use: extern "C" char* GetGreeting(void);

extern  _GLOBAL_OFFSET_TABLE_

global  GetGreeting
global  greeting:data               ; define global to make relocatable

section .data
    ; define our string here
    greeting:   db  "Hello from NASM "
%ifidn __OUTPUT_FORMAT__, elf64
    db "64"
%else
    db "32"
%endif
    db " bits on Android", 0
    ; for c++ strings end with zero so our length isn't necessary, you can however define
    ; the length as global data so we can ask the length instead of calculating it

section .text

GetGreeting:
%ifidn __OUTPUT_FORMAT__, elf64
    bits 64
    %define REG_BP rbp
    %define REG_AX rax
    %define REG_BX rbx
    %define REG_SP rsp
    %define WRD qword
    %define SIZE 8
%else
    bits 32
    %define REG_BP ebp
    %define REG_AX eax
    %define REG_BX ebx
    %define REG_SP esp
    %define WRD dword
    %define SIZE 4
%endif
    push      REG_BP
    mov       REG_BP,REG_SP
    push      REG_BX
    call      .get_GOT
    .get_GOT:
    pop       REG_BX
    add       REG_BX,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc
    mov       REG_AX, WRD [REG_BX + greeting wrt ..got]
    mov       REG_BX,[REG_BP-SIZE]
    mov       REG_SP,REG_BP
    pop       REG_BP
    ret

Beside the unlucky definitions of our registers, we've got the assembly program for both 32 bit as well as the 64 bit architecture of our cpu.  Toggling the Build Variant from x86Debug/x86Release to x86_64Debug/x86_64Release we can build the right APK for our Android device.  Running both variants will deliver us a screen shown in examples below.

                        

32 and 64 bit output

To build the final releases for your APK look at: https://developer.android.com/studio/publish/app-signing.html