Update ScriptTemplate.cs

Fixed IndexOutOfRangeException for MultiSig. The original code accesses s.elements[s.elements.Count], which is an off-by-one error.