Delete files on SD card

    SD.remove(&filname);//returns filename

I hardly think that a method called remove() returns a file name as its primary purpose.

On most operating systems, you can't delete an open file. I'm not sure why you think that the Arduino would be an exception.

  char filname = root.openNextFile();

This is clearly wrong. The openNextFile() method does not return the opened file's name as a single character.