This will give you an effective tally table of the dates required, just work your function call into the SELECT and you should be okay:
DECLARE @toDate DATE
DECLARE @fromDate DATE
SET @fromDate = '2017-05-31'
SET @toDate='2017-06-30'
;WITH cte (Date) AS
(
SELECT @fromDate
UNION ALL
SELECT DATEADD(DAY, 1, Date)
FROM cte
WHERE Date < @toDate
)
SELECT * FROM cte