Correct User Input - x86 Linux Assembly
I have an answer in x86 tasm and written under Windows, so I'm not sure if this will help, apologies if it doesn't. Maybe the way its done will give you some ideas.

.model small
.stack 100h
.data


    colour db 00001111b
    input db 10, 0, " " ; 

.code

main:

    call initsegs
    call readstring
    call printstring
    call exit



PROC printstring 

    push bx dx cx ax bp
    mov bx, 1; 1st (after zero) byte of input we are after, the length
    xor dx, dx; make sure dx contains zero before we play with dh and dl

    mov dl, input[bx]
    mov cx, dx; cx now has the 2nd byte value in the string, ie the length

    mov ah, 13h ; int 13h of 10h, print a string
    mov al, 1 ; write mode: colour on bl    
    mov bh, 0 ; video page zero
    mov bl, colour; colour attribute

    mov dh, 10; row
    mov dl, 10; column
    mov bp, offset input ; es:bp needs to point at string..this points to string but includes its max and length at the start

    add bp, 2 ; skip the first two elements which will be the length and amount used
    int 10h;


    pop bp ax cx dx bx

    ret

ENDP printstring


PROC readstring 

    push ax dx


    mov ah, 0ah ; function a of 21h - read a string
    mov dx, offset input ; reads string into DS:DX so DX needs be offset of string variable

    int 21h ; call the interrupt

    pop dx ax

    ret

ENDP readstring



PROC exit

    mov ah, 4ch
    INT 21h

    RET

ENDP Exit


PROC initsegs

    push ax

    mov ax, @DATA
    mov ds, ax
    mov es, ax

    pop ax

    RET

ENDP initsegs



end main