Can you also give us a sample of what you have in the file "vms.txt" ?
If that file is a real CSV file with row headers the name of your vm should be in a property of the $vm variable.
For example, if the " vms.txt" contains something like this
Name,Attribute
PC1,abcd
PC2,klmn
Your code should be
$vms = import-csv "D:\virtualisation\scripts\powershell\vms.txt"
foreach ($vm in $vms) {
get-datastore -vm (Get-Vm $vm.Name)
}