To get the highlight group that a group links to, you can use this function:

```lang-vimscript
function! GetLinkTarget(group)
    let l:groupID = hlID(a:group)
    " Get the group this highlight group links to
    let l:linkedGroupID = synIDtrans(l:groupID)
    let l:linkedGroupName = synIDattr(l:linkedGroupID, 'name')
    echom a:group . " → " . l:linkedGroupName
endfunction
```

Example usage:

    :call GetLinkTarget("vim9Comment")

Output:

    vim9Comment → Comment

---

Explanation:

1. [`hlID`](https://vim-jp.org/vimdoc-en/builtin.html#hlID()) gets the ID of the highlight group whose linked to highlight group we want to find out.
2. [`synIDtrans(l:groupID)`](https://vim-jp.org/vimdoc-en/builtin.html#synIDtrans()) gets the ID of the linked to group.
3. [`synIDattr(l:linkedGroupID, 'name')`](https://vim-jp.org/vimdoc-en/builtin.html#synIDattr()) translates the ID of the linked to group to its name.