I want to create a custom object with properties in PowerShell and then pass that object to a function. I found the online example to create custom object, but its using Has
You are creating an object. The hash table is just placeholder used to define all properties before turning them into an object.
Remove the three lines starting with write-output and you should be good. They are unnecessary and makes your function return an array and not just the object like you wanted. Use write-host if you only want to display the values to the screen while testing.