It is because you are trying to assign an array value to the record. Try:
do $$
declare
attr_array t_attr[];
txt text := 'id1#data1';
begin
attr_array[1] := (split_part(txt, '#', 1), split_part(txt, '#', 2));
raise info '%', attr_array;
end $$;
Output:
INFO: {"(id1,data1)"}
DO
However if you really need to split values using arrays:
do $$
declare
a text[];
begin
....
a := regexp_split_to_array(txt, '#');
attr_array[1] := (a[1], a[2]);
end $$;
CLICK HERE to find out more related problems solutions.