.Union() requires both sequences be the same type. in your code:
private List<GroupsA> groupsa = new();
private List<GroupsB> groupsb = new();
...
unionlist= groupsa.Union(groupsb);
groupsa and groupsb are not sequences of the same type (GroupsA vs GroupsB). its not clear why you have so many class with the same properties. but the fix is map to common type (UnionList, the result type):
unionlist = groupsa
.Select(r => new UnionList {Title = r.Title})
.Union(groupsb.Select(r => new UnionList {Title = r.Title}))
.ToList();