Converting Single Column into Multiple rows

i have single column which is starting with same string(many number of rows)
i have to convert each into a single row.how can i do that?

laknar
std
mes
23
55
laknar
isd
phone no
address
amount
99

I have to convert above like below.

laknar|std|mes|23|55
laknar|isd|phone no|address|amount|99

This will create a blank line at the top of the output, but otherwise does what you want.

awk '{
  if ($0 == "laknar") {
    printf("\n%s", $0)
  } else {
    printf("|%s", $0)
  }
}' inputfile

I checked the script it just adding pipe before the each line.
shall i try this script

file=/path/to/inputfile
numcols=1 ## adjust to taste
n=1
IFS='
'
while [ $n -le $numcols ]
do
{
printf "%s," $( cut -f "$n" "$file" )
echo
} > file_col$n
n=$(( $n + 1 ))
done

here every starting with string called laknar.
how can i acheive that?