I want a macro to write a named range to a csv file on Linux

I have a named range of cells, 2 columns X 12 rows, that I want to write to a file each day after other daily functions have been done and calculated.

The two main options you have using the facilities on board:

A
Use the simple file related routines coming with the LibreOffice Basic and write your values directly to an ordinary text file. The needed separators and field delimiters you need to concatenate yourself then.
See Run-Time Functions - LibreOffice Help

B
Create a temporary spreadsheet document using the API method loadComponentFromURL with the private:factory/scalc URL.
Copy your range to the first sheet there (starting with cell A1), and use the API method .saveAsURL then to write the csv-file. The calling code you may write in Basic again. No need of a full-grown programming language insofar.
See “English Macro Document” from www.pitonyak.org/oo.php for examples and explanations, e.g.