Edit node as text link in Twig How to write the same code in Twig?

&lt;?php print l(t('Edit this node'), 'node/' . $entity-&gt;nid . '/edit'); ?&gt;
See this example from Functions - In Twig Templates:

{# Link to node page. #}
&lt;a href="{{ path('entity.node.canonical', {'node': node.id}) }}"&gt;{{ 'View node page'|t }}&lt;/a&gt;


in which you need to use the route to edit the node: entity.node.edit_form