f.write(str(Path))
f.write("\n")
f.write(str(Monthly))
path is a string but Monthly is date. I can Insert all in a text file but I am not getting the desired output:
The output that I wish should be
D:\python
2021-04-08
But the output that I get is
D:\python
<---causing error is this gap
2021-04-08
The extra line after the path is causing problems.
You literally used two newlines that caused the blank space. You may remove any of them to fix the issue for getting the desired output.