Hello Santosh,
I'm a relatively new user of dDocent and I've been having a few problems with samtools, so your question came up when I did a search of this site. Since no one else has answered I'll give it a shot, in case you're still waiting for help.
Your reference.fasta file has nothing in it and looking at your log it seems your bam files are not formatted correctly so I don't see how a reference seq could be built. Your issues seem related to the problems I had before. Did you try to start a run of dDocent without this script first, (just type dDocent on the command line) to see if your install is all right? Both my recent conda installs on my own computer and the HPC cluster I am now using had to have samtools updated to actually run correctly. I did not understand about running this test the first time I tried to use dDocent, but it is very useful. Once you know the install is correct and all the software is working you can troubleshoot any additional problems you have.
Good luck.