Instead of the_attachment_link
use the following:
echo wp_get_attachment_link($attachment->ID, 'full', false, false, true);
wp_get_attachment_link
is what’s being called internally by the_attachment_link
, the last parameter set to true makes it output a text link instead of an image.