in csv file data is not in proper format show some html code in cakephp

data in csv file is not in proper format it show like as javascript code or html code in only one coloumn

code in userscontroller 

for export data in csvfile from database of user table
public function export() {

            $this->response->download("export.csv");
    
            $data = $this->Users->find('all');
            $this->set(compact('data'));
    
            $this->layout = 'ajax'; 
    
            
    
            return;
    
        }
    
    // app/Views/Users/export
    
    header('Content-type: text/csv');
    header("Content-Disposition: attachment; filename=export.csv");  
        
    
    
    foreach ($data as $row){
        foreach ($row['Users'] as $cell){
            // Escape double quotation marks
            $cell = '"' . preg_replace('/"/','""',$cell) . '"';
        }
        echo implode(',', $row['Users']) . "n";enter code here
    }
    
    

//image of output

      [1]: https://i.stack.imgur.com/SH5iF.png