Moving file to a new location once tasks are completed

I add tasks to separate notes and use Dataview to make these tasks visible in my daily notes. I got a code snippet from this article which worked perfectly for me.

dataviewjs  
dv.header(1, 'to - do');  
dv.taskList(dv.pages('#task').file.tasks  
.where(t => !t.completed));