To merge raster files into one, one can use gdal_merge.py. It works on a lots of raster formats (see list here). I suppose your .dem files comes from USGS
You should then be able, should gdal is properly installed with the python bindings, to merge your files into one by using the command line in something like :
gdal_merge.py -o mymergedem.dem mydem1.dem mydem2.dem mydem3.dem mydem4.dem
gdal_merge.py : This utility will automatically mosaic a set of images. All the images must be in the same coordinate system and have
a matching number of bands, but they may be overlapping, and at
different resolutions. In areas of overlap, the last image will be
copied over earlier ones.
You can then crop your data from coordinates or from a shapefile for example with the gdalwarp utility with something like :
gdalwarp -t_srs EPSG:[Replace with yours] -te xmin ymin xmax ymax mymergedem.dem mycropped.dem
gdalwarp : The gdalwarp utility is an image mosaicing, reprojection and warping utility. The program can reproject to any supported projection, and
can also apply GCPs stored with the image if the image is "raw" with
control information.
Or with gdal_translate :
- Unprojected:
gdal_translate -srcwin xmin ymin xmax ymax mymergedem.dem mycropped.dem
- Projected:
gdal_translate -projwin ulx uly lrx lry mymergedem.dem mycropped.dem
gdal_translate : The gdal_translate utility can be used to convert raster data between different formats, potentially performing some
operations like subsettings, resampling, and rescaling pixels in the
process.
To make sure it works, you might need to review the description page of the different utilities and if necessary split your question and/or search for different aspects of what could be blocking you (how to install gdal, how to use gdal_merge, how to use gdal_translate or gdalwarp).