How can I create a filegroup on SQL Server attaching a bare filename?
You can't construct a path inside the ALTER DATABASE command, so you're going to have to use dynamic SQL.

If you want to just put the new data file in the default instance path, you can do as Scott suggests - use the server property for default data path:

DECLARE @dbname sysname = N'myapp_db';

DECLARE @path nvarchar(511) = 
  CONVERT(nvarchar(511), SERVERPROPERTY('InstanceDefaultDataPath');

DECLARE @sql nvarchar(max) = N'ALTER DATABASE $db$
  ADD FILEGROUP data_fg;

ALTER DATABASE $db$ ADD FILE (
    NAME=data_fg,
    FILENAME=''data_fg.ndf'',
    SIZE=32MB,
    MAXSIZE=4096MB,
    FILEGROWTH=32MB
) TO FILEGROUP data_fg;';

SET @sql = REPLACE(REPLACE(@sql, N'$path$', @p), N'$db$', @dbname);

PRINT @sql;
-- EXEC sys.sp_executesql @sql;


If, however, you want to base this off an existing database (maybe the one you're altering, if they pass that by a parameter), then you could do this:

DECLARE @dbname sysname = N'model';

DECLARE @p nvarchar(511);

;WITH x AS (SELECT TOP (1) p = physical_name, type_desc
  FROM sys.master_files
  WHERE database_id = DB_ID(@dbname)
  AND type_desc = N'ROWS'
  ORDER BY file_id
)
SELECT @p = SUBSTRING(p, 1, LEN(p)-CHARINDEX('/',REVERSE(p))+1)
FROM x;

DECLARE @sql nvarchar(max) = N'ALTER DATABASE $db$
  ADD FILEGROUP data_fg;

ALTER DATABASE $db$ ADD FILE (
    NAME=data_fg,
    FILENAME=''data_fg.ndf'',
    SIZE=32MB,
    MAXSIZE=4096MB,
    FILEGROWTH=32MB
) TO FILEGROUP data_fg;';

SET @sql = REPLACE(REPLACE(@sql, N'$path$', @p), N'$db$', @dbname);

PRINT @sql;
-- EXEC sys.sp_executesql @sql;


You may even want to allow your users to override with a specific path (think of the case where the current drive is getting crowded and they want to start this new file in a totally new location).

It also strikes me as weird that you'd bother creating a data file that is only 32 MB. That's barely big enough to hold the metadata about the file, and will surely start a cycle of autogrowths as soon as it becomes active.