Tag to fetch URL and Title of a entry when supplied it's ID
This is all you need:

{% set linkedEntry = craft.entries.id(42).first() %}
&lt;a href="{{ linkedEntry.url }}"&gt;{{ linkedEntry.title }}&lt;/a&gt;


If you use this in many places you can also make a macro.

{% macro linkToEntry(entryId) %} 

    {# Get the entry with the selected ID #}
    {% set linkedEntry = craft.entries.id(entryId).first() %}

    {# Make sure the entry exists and output the link #}
    {% if linkedEntry %}
        &lt;a href="{{ linkedEntry.url }}"&gt;{{ linkedEntry.title }}&lt;/a&gt;
    {% endif %}

{% endmacro %}


It's nice to have macros in a separate file and import it into your templates. I really love using macros for this kind of code snippets, very useful and DRY.

{% import "macros.html" as macros %}

&lt;li&gt;{{ macros.linkToEntry(42) }}&lt;/li&gt;
&lt;li&gt;{{ macros.linkToEntry(17) }}&lt;/li&gt;
&lt;li&gt;{{ macros.linkToEntry(20) }}&lt;/li&gt;