Need Help: Output Formatting in Separate Line

I am using below code to do a Ping Test on Multiple Servers. I am taking two variables to Capture the Pingable Servers and the servers which are not pinging.

The Output is coming like

INFO: Below Servers are up
server1 server2 server3
Below Servers are Not Pinging
Server1 server2 server3.

function Get-EncaseInfo {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $True)]
        [string[]]$serverName
    )
    process {
        $servers = (Get-Content D:\IT\servers.txt)
        $server_error = $false
        $servers_down = @()
        $servers_up = @()
        foreach ($server in $serverName) {
            if(Test-Connection $server -Count 1 -ea 0 -Quiet){
            #Write-Host $server "is Pinging" -BackgroundColor Green -ForegroundColor White
            $servers_up += "$server"

            }else{
            #Write-Host $server "is not Pinging" -BackgroundColor Red -ForegroundColor White
            $servers_down += "$server"
            $server_error = $true
            }}
            
            Write-Host "INFO: Below Servers are up" -ForegroundColor Green
            Write-Host "$servers_up" -ForegroundColor Green
            if($server_error){
            $error_msg = "Below Servers are not Pinging"
            Write-Host $error_msg -ForegroundColor Red
            Write-Host "$servers_down" -ForegroundColor Red
            }else{

            Write-Host "INFO: ALL Servers are Pinging" -ForegroundColor Green -BackgroundColor White
        }
        }
    }


Get-EncaseInfo -serverName (Get-Content D:\IT\servers.txt)

How can i get the output where every server is showing in a separate Line e.g.

INFO: Below Servers are up
server1
server2
server3

Below Servers are Not Pinging
Server1
server2
server3

In PowerShell we work with objects with properties - not strings! :smirk:

$servers_down += $server

You should not use Write-Host

Write-Host gives options like -BackgroundColor and -ForegroundColor but Write-output does not.

by the way, changing from write-host to write-output fixed the issue