Adding the contextual link render element I have render array like this.

$array = [
  '#theme' =&gt; 'theme_wrap',
  '#content' =&gt; $data,
  '#contextual_links' =&gt; [
    'my_module' =&gt; [
      'my_module.router.name', $pid
    ]
  ]


and theme-wrap.html.twig

{%
set classes = [
'contextual-region'
]
%}
&lt;div {{ attributes.addClass(classes) }}&gt;
  {{ title_prefix }}
  {{ title_suffix }}
  {{ content }}
&lt;/div&gt;


and file mymodule.links.contextual.yml

mymodule.admin.edit:
  title: 'Edit'
  route_name: my_module.router.name
  group: my_module


and route name my_module.router.name exited and working. Render data array working but don't see contextual link. 

Update: I have a form to user can enter input. After submit i'll show data from user. And simple controller return array above. 
- I have insert {{ title_suffix }},{{ title_prefix }} class contextual-region but don't working.

I was doing something wrong?
Please help!
First of, usually you want to handle the contextual links in your preprocess theme function so you don't have to handle it every time you need to render the thing.

The actual contual links is added to title_suffix, so you need to do {{ title_suffix }} somewhere in your template to actual render the contextual links. You also need to render the attributes or make sure your wrapper html tag has the contextual-region class.

In Drupal 8, most of contexual links are used with relationship to an entity. If you have something you can view and edit most likely it should be an entity, meaning you should use the entity view builder to render it etc. Might also make it easier for you to do contextual links, as there are many examples of how this is done in core and contrib, like the node module, user module taxonomy module etc.