How to merge multiple rows in one column with hierarchy Postgresql 12?
Its a bit lengthy,
So the steps are:

Old Table

create table test (id int, service varchar, subservice varchar, description varchar, cost decimal(10,2));


New Table

create table newtest(id int, description varchar, parent_id int, cost decimal(10,2));


Create a sequence as you have mentioned in your question

CREATE SEQUENCE seq_parent_id INCREMENT BY 1 START WITH 1 NO CYCLE;


Now Run below query

with cte(id, description, parent_id,cost) as 
(select nextval('seq_parent_id'), service, null::bigint,0::decimal  
from test group by 2
),
cte1(id, description, parent_id,cost) as 
(select nextval('seq_parent_id'), subservice, t2.id,0::decimal 
from test t1 
inner join cte t2 on t1.service=t2.description and t2.parent_id is null group by 2,3
)

insert into newtest

select * from cte
union all
select * from cte1
union all
select t1.id,t1.description,t3.id,t1.cost from test t1 
inner join cte t2 on t1.service=t2.description and t2.parent_id is null
inner join cte1 t3 on t1.subservice=t3.description and t3.parent_id=t2.id

DEMO
Explanation of above query is demonstrated in this fiddle
NOTE: Before running the query please ensure that counter value will not cross the already existing ID. If newly inserted rows are more than minimum existing count then set the start of sequence max(id)+1 before running this query.