Got a bug but Can't able to point out!

Hello Friends,
I am practicing on puzzle “There is no spoon- Episode 1”, till now i am doing well and fine.
but then i got a bug in nested for loop, but not able to point it out…
I hope someone just give me some advice tell me why this is happening?
I am attaching my code.
Any help will be appreciated. ThankYou!
Sorry for bad English!

See the bug Image Here…

var width = parseInt(readline()); // the number of cells on the X axis
var height = parseInt(readline()); // the number of cells on the Y axis
var xNodes = [];  
var coords = {
        xP: '0',
        yP: '0',
        xR: '-1',
        yR: '-1',
        xB: '-1',
        yB: '-1'
    };

for (var i = 0; i < height; i++) {
    var line = readline(); // width characters, each either 0 or .
    var nodeList = line.split('');
    xNodes.push([]);
    for(var j = 0; j < width; j++) {
        if(nodeList[j] == '0') {
            xNodes[i].push(nodeList[j]);    
        } else {
            xNodes[i].push('-1');    
        }
    }   
}

for(var k = 0; k < xNodes.length; k++) {
    
    for(var l = 0; l < width; l++){
        
        switch(xNodes[k][l]) {
            case '0' :
                coords.xP = l;
                coords.yP = k;
                break;
            case '.' :
                coords.xP = '-1';
                coords.yP = '-1';
                break;
            default:
                coords;
                break;
        }
        
    /// SEE this line is giving me some Hint!!
    // but i am not able to point out!!
    ///>>>>
        
        printErr("K: ", coords.xP + " L: ", coords.yP);
       
       ////<<<<
        if((coords.xP+1 < width) && (xNodes[k][l+1] != '.')) {
            coords.xR = l+1;
            coords.yR = k;
        } else {
            coords.xR = '-1';
            coords.yR = '-1';
        }
        
        if((coords.yP+1 < height) && (xNodes[k+1][l] != '.')) {
            coords.xB = l;
            coords.yB = k+1;
        } else {
            coords.xB = '-1';
            coords.yB = '-1';
        }
        
        print(coords.xP+' '+coords.yP+' '+coords.xR+' '+coords.yR+' '+coords.xB+' '+coords.yB);
    
    }
}

First, don’t post full code in here.

Second, perhaps you want to have printErr(string + string + string + string) not printErr(string, string + string, string)

Sorry, I did not know this. next time i’ll be careful.
and i am not talking about printing string…
but the variables k and l that are simply in a nested loop

for(var k = 0; k < xNodes.length; k++) {
 for(var l = 0; l < width; l++) {
       printErr("K: ", k + " L: ", l);
  }
}

the output should be like this
K: 0, L:0
K: 1, L:0
K: 0, L:1
K: 1, L:1
but instead of this it outputs
K: 0, L:0
K: 1, L:0
K: 0, L:1
K: 0, L:1

Which is why I said to use + instead of ,. Try

printErr("K: " + k + " L: " + l)