not able to export with powershell script
===

I new to powershell. following is my requirement - 
Read a csv log file and based on the email field, i have to query and export the result to a csv file.
Below is a sample log file - 
emailid,date,time,client_ip,client_hostname,server_ip,server_hostname,source,event_id
manu@ionidea.com,05-24-2012,11:12:00,23.3.45.678,tytytyty,12.21.3.45,yuyuyuyuyu,hrertythghhdgfh,00928
ram@ionidea.com,06-05-2012,11:14:23,91.45.78.980,juqawessjj,16.51.5.93,pmbctr,ioyrhrtgdgdggdgjhjhj,00929
sheetal@ionidea.com,07-10-2012,11:12:00,10.0.87.369,yturbctyt,10.34.0.788,kokolioimdgf,brytifvnbty,00930

and i am using following script to do this - 

function saveAndRun(){
    
    $var_newJob = $window.FindName("txtbox_JobName").Text+".txt";
    write-host $var_newJob
    $varArray_emailIds =  ($window.FindName("txtbox_Email").Text).split(',');
    $var_fromDate = "'"+ $window.FindName("txtbox_FromDate").Text+"'";
    $var_toDate =  "'"+$window.FindName("txtbox_ToDate").Text+"'";
    $list="";
    ForEach($var_emailid in $varArray_emailIds){
    $emailid = "'"+$var_emailid+"'";
    ForEach-Object{
       
    Import-Csv D:\Manu\Xtract\Log\MSLogFile.txt | Where-Object {$_.emailid -eq $emailid -and ($_.date -ge $var_fromDate -and $_.date -le $var_toDate ) }
    
    } | Export-Csv -Path D:\Manu\Xtract\extract\$var_newJob
    } 
  
   
}

plz help me!!! its urgent..
Manu