You'd have to define what you want first. You have so many "Write-Host" cmdlets it's impossible to know what data is being used to track the progress of you script and what information you want in the CSV.
Start by having the function GetDBUserInfo return something to your the caller (if it's supposed to return anything). Right now it just shows data on the console. Then start placing some of the information you're displaying into variables. Once you've done that you can create a PSCustomObject that holds what you want in the CSV.
Because you use the "Foreach ($x in $y)" format instead of "$y | Foreach-Object {scriptblock code}" you don't have a pipeline so you'll accumulate the PSCustomObjects you create in an array. After the last part of your script (currently line #76) you can pipe the array into Export-VSV.