Try this:
$file = Read-Host -Prompt "Enter Path"
$beginning_content = Read-Host -Prompt "Please enter what to add at beginning of each line"
$end_content = Read-Host -Prompt "Please enter what to add to the end of each line"
$content = Get-Content $file
$count = 0
$next = ''
ForEach ($line in $content) {
$beginning_content_replace = $line -replace '^', $beginning_content
$end_content_replace = $beginning_content_replace -replace '$', $end_content
$next = $next + ' ' + $end_content_replace
$count += 1
if ($count -eq 5) {
echo $next
$next = ''
$count = 0
}
}
echo $next