How do you know the number of attachments? Is this known pre-send or not until send-time? Is this a Triggered Send or User-Initiated?
Depending on these answers, you could achieve this in several ways.
The main solution path I would explore would be to do some sort of LookupRows() or LookupOrderedRows() to retrieve the files to be attached, then loop through those rows and attach the files. Also, it is important to note that AttachFile() functions need to executed in inline-AMP Script, %%=AttachFile()=%%, not in AMP code blocks, %%[ ...... ]%%.
So your code would probably look something like the following (I included an example of files hosted on an external site, the ET FTP, and the Portfolio):
%%[ VAR @sub, @fileDe, @files, @file, @fileUrl, @fileName, @fileExternalKey
SET @sub = [_subscriberkey]
SET @fileDE = "Name Data Extension holding attachment filename/url"
/*LookupRows() from DE. Assumes data extension uses SubscriberKey as the foreign key*/
SET @files = LookupRows(@fileDe,"SubscriberKey",@sub)
/*Validate files were returned*/
IF Rowcount(@files) > 0 THEN
FOR @i = 1 TO Rowcount(@files) DO
SET @file = Row(@files,@i)
/*If you are using files hosted at an external HTTP/HTTPS location*/
SET @fileUrl = Field(@file,"FileURL")
]%%
%%=AttachFile("HTTP",@fileUrl)=%%
%%[
/*If you are using files hosted in the Import folder of the ExactTarget FTP*/
SET @fileName = Field(@file,"FileName")
]%%
%%=AttachFile("FTP",@fileName)=%%
%%[
/*If you are using files hosted in the ExactTarget Portfolio*/
SET @fileName = Field(@file,"PortfolioFileExternalKey")
]%%
%%=AttachFile("Portfolio",@fileExternalKey)=%%
%%[
NEXT @i
ELSE
/*No records returned for @files*/
ENDIF
]%%