Are you talking about (something like) this:
<?php
$args = array(
'numberposts' => 2,
);
$recent_posts = wp_get_recent_posts($args);
foreach ($recent_posts as $recent) {
?>
<li>
<a href="https://wordpress.stackexchange.com/questions/127441/<?php echo get_permalink($recent["ID']); ?>" title="<?php echo esc_attr($recent["post_title"]); ?>">
<?php echo $recent["post_title"]; ?>
</a> >
</li>
<?php
}
?>
If so, what was the problem?